Documentation
ExpressVideoSDK Video Call
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • Video Call
  • Resources & Reference
  • SDK
  • Upgrade guide
  • Upgrade to v2.23.0+

Upgrade to v2.23.0 or above

Last updated:2023-09-27 14:34

  • If your current SDK version is lower than 2.23.0, when you need to upgrade to any version of 2.23.0 or above. Please make sure to read this document.
  • In addition, it is recommended that you refer to the business-related interfaces changes in the Release notes between the current version and the target version.

This article provides general instructions and precautions when you upgrade the Express Flutter SDK version to 2.23.0 or above.

Changes

To support developers in implementing the video rendering feature, the ZegoExpressTextureRenderUtils and ZegoExpressPlatformViewUtils API modules have been removed since v2.23.0.

When upgrading from an old version to v2.23.0, developers need to migrate to the new ZegoExpressCanvasViewUtils API module to implement the video rendering feature.

The new ZegoExpressCanvasViewUtils API module supports both External Texture and PlatformView rendering methods.

Reason

The Express Flutter SDK supports two rendering methods: External Texture and PlatformView

Prior to v2.22.0, the two rendering methods correspond to two sets of APIs. Since Flutter only supports one of the rendering methods on some platforms, developers need to determine which set of APIs can be used in the corresponding platform.

  • External Texture:ZegoExpressTextureRenderUtils
    • createTextureRenderer
    • destroyTextureRenderer
    • updateTextureRendererSize
  • PlatformView:ZegoExpressPlatformViewUtils
    • createPlatformView
    • destroyPlatformView

To reduce the cost of use for developers, a new set of APIs is launched in the v2.22.0 version:

  • ZegoExpressCanvasViewUtils
    • createCanvasView
    • destroyCanvasView

This set of APIs eliminates the differences associated with the use of the previous two rendering methods and supports both External Texture and PlatformView rendering methods.

  • For platforms that support both rendering methods, the use of PlatformView or External Texture is determined according to the enablePlatformView parameter when createEngineWithProfile is called.

  • For platforms that only support one of the rendering methods, the supported rendering method is used by default, and the enablePlatformView parameter will be ignored. The behavior mode of the enablePlatformView parameter is preference instead of specify.

The SDK v2.23.0 or above supports macOS and Windows. The following rendering methods and platforms are supported by the current version:

Method\Platform Android iOS macOS Windows Web Linux
External Texture ✔️ ✔️ ✔️ ✔️ ✖ ✖
PlatformView ✔️ ✔️ ✖ ✖ ✔️ ✖

To support CanvasView, the implementation of the video rendering function is refactored. While this improves performance, it also destroys the original ZegoExpressTextureRenderUtils behavior (view mode abnormal).

To ensure a good user experience, we decided to delete the ZegoExpressTextureRenderUtils and ZegoExpressPlatformViewUtils API modules.

Developers should migrate to the new ZegoExpressCanvasViewUtils API module, and take note of the following API changes:

Old New
createTextureRenderer createCanvasView
destroyTextureRenderer destroyCanvasView
updateTextureRendererSize No need to call it anymore, the SDK will handle it automatically.
createPlatformView createCanvasView
destroyPlatformView destroyCanvasView

Sample

You can refer to the following sample code or example demo for migration.

v2.22.0 and below

  • External Texture
// TextureRenderer

late int _viewID;
Widget? _viewWidget;

void start() {
  ZegoExpressEngine.instance.createTextureRenderer(width, height).then((viewID) {
    _viewID = viewID;
    setState(() {
      _viewWidget = Texture(textureId: viewID)
    });
    ZegoCanvas canvas = ZegoCanvas.view(viewID);
    // Call [startPreview] or [startPlayingStream]
    // ......
  });
}

void stop() {
  // Call [stopPreview] or [stopPlayingStream]
  // ......
  ZegoExpressEngine.instance.destroyTextureRenderer(_viewID);
}
  • PlatformView
// PlatformView

late int _viewID;
Widget? _viewWidget;

void start() {
  setState(() {
    _viewWidget = ZegoExpressEngine.instance.createPlatformView((viewID) {
      _viewID = viewID;
      ZegoCanvas canvas = ZegoCanvas.view(viewID);
      // Call [startPreview] or [startPlayingStream]
      // ......
    });
  });
}

void stop() {
  // Call [stopPreview] or [stopPlayingStream]
  // ......
  ZegoExpressEngine.instance.destroyPlatformView(_viewID);
}

v2.23.0 or above

// CanvasView

late int _viewID;
Widget? _viewWidget;

void start() {
  ZegoExpressEngine.instance.createCanvasView((viewID) {
    _viewID = viewID;
    // Call [startPreview] or [startPlayingStream]
    // ......
  }).then((widget) {
    setState(() {
      _viewWidget = widget;
    });
  });
}

void stop() {
  // Call [stopPreview] or [stopPlayingStream]
  // ......
  ZegoExpressEngine.instance.destroyCanvasView(_viewID);
}
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code