Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
Public Member Functions | List of all members
agora::rtc::IMediaStreamingSource Class Referenceabstract

`#include <IAgoraMediaStreamingSource.h>`

Inherits agora::RefCountInterface.

Inherited by agora::rtc::IMediaStreamingSourceEx.

## Public Member Functions
virtual | ~IMediaStreamingSource ()
virtual int | open (const char *url, int64_t start_pos, bool auto_play=true)=0
virtual int | close ()=0
virtual int | getSourceId () const =0
virtual bool | isVideoValid ()=0
virtual bool | isAudioValid ()=0
virtual int | getDuration (int64_t &duration)=0
virtual int | getStreamCount (int64_t &count)=0
virtual int | getStreamInfo (int64_t index, media::base::PlayerStreamInfo *out_info)=0
virtual int | setLoopCount (int64_t loop_count)=0
virtual int | play ()=0
virtual int | pause ()=0
virtual int | stop ()=0
virtual int | seek (int64_t new_pos)=0
virtual int | getCurrPosition (int64_t &pos)=0
virtual STREAMING_SRC_STATE | getCurrState ()=0
virtual int | appendSeiData (const InputSeiData &inSeiData)=0
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
Public Member Functions inherited from agora::RefCountInterface
virtual void | AddRef () const =0
virtual RefCountReleaseStatus | Release () const =0
virtual bool | HasOneRef () const =0

## Additional Inherited Members
Protected Member Functions inherited from agora::RefCountInterface
virtual | ~RefCountInterface ()

## Detailed Description

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

## Constructor & Destructor Documentation

## ◆ ~IMediaStreamingSource()

virtual agora::rtc::IMediaStreamingSource::~IMediaStreamingSource | ( |  | ) |
| inline virtual

## 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