openWithMediaSource

Opens a media file and configures the playback scenario.

virtual int openWithMediaSource(const media::base::MediaSource &source) = 0;

This method supports opening media files from different sources, including custom media sources, and allows you to configure the playback scenario.

Note: openWithMediaSource is an asynchronous call. If you need to play the media file, make sure you have received the onPlayerSourceStateChanged callback reporting PLAYER_STATE_OPEN_COMPLETED before calling the play method.

Timing

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

Parameters

source
Media resource. See MediaSource.

Return Values

  • 0: Success.
  • < 0: Failure.