setVideoSource method

Future<int> setVideoSource(
  1. ZegoVideoSourceType source,
  2. {int? instanceID,
  3. ZegoPublishChannel? channel}
)

Set a video capture instance as video capture source for the specified channel.

Available since: 3.1.0 Description: Set video capture source for switching between different video capture sources. Use cases: Typically used in educational scenarios that require switching between different video capture sources. When to call: After the engine is created createEngine. Restrictions: Calling in publishing or preview is invalid when using the web platform. Caution: 1. Main push channel ZegoPublishChannel.Main does not support using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type. 2. When using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type in aux publish channel ZegoPublishChannel.Aux, must ensure that physical device works on main publish channel ZegoPublishChannel.Main. 3. Preemptive video sources are not allowed to be used on multiple channels at the same time, such as ZegoVideoSourceType.Camera and ZegoVideoSourceType.ScreenCapture. 4. The other publish channel can copy the main publish channel only when the main publish channel uses internal video capture. A maximum of one copy is supported. 5. When using ZegoVideoSourceType.Player video source type, please ensure that the ZegoMediaPlayer instance is created successfully. Note: This function is only available in ZegoExpressVideo SDK!

  • source Video capture source.
  • instanceID Video capture source instance id.
  • channel Publish stream channel.

Implementation

Future<int> setVideoSource(ZegoVideoSourceType source,
    {int? instanceID, ZegoPublishChannel? channel}) async {
  return await ZegoExpressImpl.instance
      .setVideoSource(source, instanceID: instanceID, channel: channel);
}