openWithMediaSource abstract method

Future<void> openWithMediaSource(
  1. MediaSource source
)

Opens a media resource and sets playback options.

This method allows you to open different types of media resources, including custom media files, and configure playback settings. This method is asynchronous. To play the media file, call the play method after receiving the onPlayerSourceStateChanged callback reporting the state playerStateOpenCompleted.

  • source Media resource. See MediaSource.

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly. See Error Codes for details and resolution suggestions. < 0: Failure. See Error Codes for details and resolution suggestions.

Implementation

Future<void> openWithMediaSource(MediaSource source);