createTextureView method

void createTextureView({
  1. HMSTrack? track,
  2. bool addTrackByDefault = true,
  3. bool? disableAutoSimulcastLayerSelect,
})

(Android Only) createTextureView is used to create the texture view. It takes track as an optional parameter. If track is provided, then it will add the track to the texture view by default. If addTrackByDefault is set to true, then it will add the track to the texture view by default. If disableAutoSimulcastLayerSelect is set to true, then it will disable the auto simulcast layer selection.

Implementation

void createTextureView(
    {HMSTrack? track,
    bool addTrackByDefault = true,
    bool? disableAutoSimulcastLayerSelect}) async {
  if (Platform.isAndroid) {
    var result = await PlatformService.invokeMethod(
        PlatformMethod.createTextureView,
        arguments: {
          "track_id": track?.trackId,
          "add_track_by_def": addTrackByDefault,
          "disable_auto_simulcast_layer_select":
              disableAutoSimulcastLayerSelect ?? false
        });
    if (result["success"]) {
      _textureId = result["data"]["texture_id"];
      EventChannel('HMSTextureView/Texture/$textureId')
          .receiveBroadcastStream()
          .listen(_eventListener);
      if (_updateViewCallback != null) {
        _updateViewCallback!();
      }
    }
  }
}