openWithMediaSource

Opens a media file and configures the playback scenario.

int openWithMediaSource(MediaPlayerSource source);

This method supports opening different types of media files, including URI files that start with content:// and media files in the assets folder, and sets playback options.

Note: This method is asynchronous. To play the media file, make sure you have received the onPlayerStateChanged callback reporting OPEN_COMPLETED before calling play.

Timing

You can call this method before or after joining a channel.

Parameters

source
The media resource. See MediaPlayerSource.

Return Values

  • 0: Success.
  • < 0: Failure.