Agora C++ API Reference for All Platforms
Public Member Functions | List of all members
agora::rtc::IMediaStreamingSource Class Referenceabstract

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 ()
 

Constructor & Destructor Documentation

◆ ~IMediaStreamingSource()

virtual agora::rtc::IMediaStreamingSource::~IMediaStreamingSource ( )
inlinevirtual

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
urlThe path of the media file. Both the local path and online path are supported.
startPosThe starting position (ms) for pushing. Default value is 0.
auto_playwhether 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]durationA reference to the duration of the media file.
Returns

◆ getStreamCount()

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

Gets the number of the streming source.

Parameters
[out]countThe number of the media streams in the media source.
Returns

◆ 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
indexThe index of the media stream.
[out]out_infoThe detailed information of the media stream. See PlayerStreamInfo for details.
Returns

◆ setLoopCount()

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

Sets whether to loop the streaming source for playback.

Parameters
loop_countThe 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

◆ play()

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

Play & push the streaming source.

Returns

◆ pause()

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

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

Returns

◆ stop()

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

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

Returns

◆ 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
newPosThe new playback position (ms).
Returns

◆ getCurrPosition()

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

Gets the current playback position of the media file.

Parameters
[out]posA reference to the current playback position (ms).
Returns

◆ 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
typeSEI type
timestampthe video frame timestamp which attached to
frame_indexthe video frame timestamp which attached to
Returns

◆ 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
observerThe pointer to the IMediaStreamingSource object.
Returns

◆ unregisterObserver()

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

Releases the media player source observer.

Parameters
observerThe pointer to the IMediaStreamingSource object.
Returns

◆ 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