Agora Java API Reference for Android

Public Member Functions | List of all members
agora::rtc::IMediaStreamingSource Class Referenceabstract

The IMediaStreamingSource class provides access to a media streaming source demuxer. To playout multiple stream sources simultaneously, create multiple media stream source objects. More...

`#include <IAgoraMediaStreamingSource.h>`

Inheritance diagram for agora::rtc::IMediaStreamingSource:

## Public Member Functions
virtual int | open (const char *url, int64_t start_pos, bool auto_play=true)=0
| Opens a media streaming source with a specified URL. More...
virtual int | close ()=0
| Close current media streaming source. More...
virtual int | getSourceId () const =0
| Gets the unique source ID of the streaming source. More...
virtual bool | isVideoValid ()=0
| Retrieve whether video stream is valid. More...
virtual bool | isAudioValid ()=0
| Retrieve whether audio stream is valid. More...
virtual int | getDuration (int64_t &duration)=0
| Gets the duration of the streaming source. More...
virtual int | getStreamCount (int64_t &count)=0
| Gets the number of the streming source. More...
virtual int | getStreamInfo (int64_t index, media::base::PlayerStreamInfo *out_info)=0
| Gets the detailed information of a media stream. More...
virtual int | setLoopCount (int64_t loop_count)=0
| Sets whether to loop the streaming source for playback. More...
virtual int | play ()=0
| Play & push the streaming source. More...
virtual int | pause ()=0
| Pauses the playing & pushing of the streaming source, Keep current position. More...
virtual int | stop ()=0
| Stop the playing & pushing of the streaming source, set the position to 0. More...
virtual int | seek (int64_t new_pos)=0
| Sets the playback position of the streaming source. After seek done, it will return to previous status. More...
virtual int | getCurrPosition (int64_t &pos)=0
| Gets the current playback position of the media file. More...
virtual STREAMING_SRC_STATE | getCurrState ()=0
virtual int | appendSeiData (const InputSeiData &inSeiData)=0
| append the SEI data which can be sent attached to video packet More...
virtual int | registerObserver (IMediaStreamingSourceObserver *observer)=0
virtual int | unregisterObserver (IMediaStreamingSourceObserver *observer)=0
virtual int | parseMediaInfo (const char *url, media::base::PlayerStreamInfo &video_info, media::base::PlayerStreamInfo &audio_info)=0
| Parse a media information with a specified URL. More...
Public Member Functions inherited from agora::RefCountInterface
virtual void | AddRef () const =0
virtual RefCountReleaseStatus | Release () const =0
virtual bool | HasOneRef () const =0

## Detailed Description

The IMediaStreamingSource class provides access to a media streaming source demuxer. To playout multiple stream sources simultaneously, create multiple media stream source objects.

Deprecated:
  Since version 4.6.0, this feature has been turned off by default.

## Member Function Documentation

## ◆ open()

virtual int agora::rtc::IMediaStreamingSource::open | ( | const char * | url,
|  | int64_t | start_pos,
|  | bool | auto_play = `true`
| ) |  |
| pure virtual

Opens a media streaming source with a specified URL.

Parameters

  url | The path of the media file. Both the local path and online path are supported.
  startPos | The starting position (ms) for pushing. Default value is 0.
  auto_play | whether start playing after opened

Returns
  - 0: Success.
  - < 0: Failure

## ◆ close()

virtual int agora::rtc::IMediaStreamingSource::close | ( |  | ) |
| pure virtual

Close current media streaming source.

Returns
  - 0: Success.
  - < 0: Failure

## ◆ getSourceId()

virtual int agora::rtc::IMediaStreamingSource::getSourceId | ( |  | ) | const
| pure virtual

Gets the unique source ID of the streaming source.

Returns
  - ≧ 0: The source ID of this media player source.
  - < 0: Failure.

## ◆ isVideoValid()

virtual bool agora::rtc::IMediaStreamingSource::isVideoValid | ( |  | ) |
| pure virtual

Retrieve whether video stream is valid.

Returns
  : valid or invalid

## ◆ isAudioValid()

virtual bool agora::rtc::IMediaStreamingSource::isAudioValid | ( |  | ) |
| pure virtual

Retrieve whether audio stream is valid.

Returns
  : valid or invalid

## ◆ getDuration()

virtual int agora::rtc::IMediaStreamingSource::getDuration | ( | int64_t & | duration | ) |
| pure virtual

Gets the duration of the streaming source.

Parameters

  [out] | duration | A reference to the duration of the media file.

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ getStreamCount()

virtual int agora::rtc::IMediaStreamingSource::getStreamCount | ( | int64_t & | count | ) |
| pure virtual

Gets the number of the streming source.

Parameters

  [out] | count | The number of the media streams in the media source.

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ getStreamInfo()

virtual int agora::rtc::IMediaStreamingSource::getStreamInfo | ( | int64_t | index,
|  | media::base::PlayerStreamInfo * | out_info
| ) |  |
| pure virtual

Gets the detailed information of a media stream.

Parameters

  | index | The index of the media stream.
  [out] | out_info | The detailed information of the media stream. See PlayerStreamInfo for details.

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ setLoopCount()

virtual int agora::rtc::IMediaStreamingSource::setLoopCount | ( | int64_t | loop_count | ) |
| pure virtual

Sets whether to loop the streaming source for playback.

Parameters

  loop_count | The number of times of looping the media file. 1: Play the media file once. 2: Play the media file twice. <= 0: Play the media file in a loop indefinitely, until stop is called.

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ play()

virtual int agora::rtc::IMediaStreamingSource::play | ( |  | ) |
| pure virtual

Play & push the streaming source.

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ pause()

virtual int agora::rtc::IMediaStreamingSource::pause | ( |  | ) |
| pure virtual

Pauses the playing & pushing of the streaming source, Keep current position.

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ stop()

virtual int agora::rtc::IMediaStreamingSource::stop | ( |  | ) |
| pure virtual

Stop the playing & pushing of the streaming source, set the position to 0.

Returns
  - 0: Success.
  - < 0: Failure.See STREAMINGSRC_ERR.

## ◆ seek()

virtual int agora::rtc::IMediaStreamingSource::seek | ( | int64_t | new_pos | ) |
| pure virtual

Sets the playback position of the streaming source. After seek done, it will return to previous status.

Parameters

  newPos | The new playback position (ms).

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ getCurrPosition()

virtual int agora::rtc::IMediaStreamingSource::getCurrPosition | ( | int64_t & | pos | ) |
| pure virtual

Gets the current playback position of the media file.

Parameters

  [out] | pos | A reference to the current playback position (ms).

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ getCurrState()

virtual STREAMING_SRC_STATE agora::rtc::IMediaStreamingSource::getCurrState | ( |  | ) |
| pure virtual

@breif Gets the status of current streaming source.

Returns
  The current state machine

## ◆ appendSeiData()

virtual int agora::rtc::IMediaStreamingSource::appendSeiData | ( | const InputSeiData & | inSeiData | ) |
| pure virtual

append the SEI data which can be sent attached to video packet

Parameters

  type | SEI type
  timestamp | the video frame timestamp which attached to
  frame_index | the video frame timestamp which attached to

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ registerObserver()

virtual int agora::rtc::IMediaStreamingSource::registerObserver | ( | IMediaStreamingSourceObserver * | observer | ) |
| pure virtual

Registers a media player source observer.

Once the media player source observer is registered, you can use the observer to monitor the state change of the media player.

Parameters

  observer | The pointer to the IMediaStreamingSource object.

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ unregisterObserver()

virtual int agora::rtc::IMediaStreamingSource::unregisterObserver | ( | IMediaStreamingSourceObserver * | observer | ) |
| pure virtual

Releases the media player source observer.

Parameters

  observer | The pointer to the IMediaStreamingSource object.

Returns
  - 0: Success.
  - < 0: Failure. See STREAMINGSRC_ERR.

## ◆ parseMediaInfo()

virtual int agora::rtc::IMediaStreamingSource::parseMediaInfo | ( | const char * | url,
|  | media::base::PlayerStreamInfo & | video_info,
|  | media::base::PlayerStreamInfo & | audio_info
| ) |  |
| pure virtual

Parse a media information with a specified URL.

Parameters

  url | : The path of the media file. Both the local path and online path are supported.
  video_info | : The output video information, It means no video track while video_info.streamIndex less than 0
  audio_info | : The output audio information, It means no audio track while audio_info.streamIndex less than 0

Returns
  - 0: Success.
  - < 0: Failure