playMedia method

Future<ZegoUIKitMediaPlayResult> playMedia({
  1. required String filePathOrURL,
  2. bool enableRepeat = false,
  3. bool autoStart = true,
})

Start playing.

Implementation

Future<ZegoUIKitMediaPlayResult> playMedia({
  required String filePathOrURL,
  bool enableRepeat = false,
  bool autoStart = true,
}) async {
  final playResult = await ZegoUIKitCore.shared.playMedia(
    filePathOrURL: filePathOrURL,
    enableRepeat: enableRepeat,
    autoStart: autoStart,
  );

  if (ZegoUIKitErrorCode.success != playResult.errorCode) {
    ZegoUIKitCore.shared.error.errorStreamCtrl?.add(ZegoUIKitError(
      code: ZegoUIKitErrorCode.mediaPlayError,
      message: playResult.message,
      method: 'playMedia',
    ));
  }

  return playResult;
}