#include <IAgoraMediaPlayerSource.h>
|
| virtual int | getSourceId () const =0 |
| |
| virtual int | open (const char *url, int64_t startPos)=0 |
| |
| virtual int | openWithMediaSource (const media::base::MediaSource &source)=0 |
| |
| virtual int | play ()=0 |
| |
| virtual int | pause ()=0 |
| |
| virtual int | stop ()=0 |
| |
| virtual int | resume ()=0 |
| |
| virtual int | seek (int64_t newPos)=0 |
| |
| virtual int | getDuration (int64_t &duration)=0 |
| |
| virtual int | getPlayPosition (int64_t &pos)=0 |
| |
| virtual int | getStreamCount (int64_t &count)=0 |
| |
| virtual int | getStreamInfo (int64_t index, media::base::PlayerStreamInfo *info)=0 |
| |
| virtual int | setLoopCount (int64_t loopCount)=0 |
| |
| virtual int | setPlaybackSpeed (int speed)=0 |
| |
| virtual int | selectAudioTrack (int64_t index)=0 |
| |
| virtual int | selectMultiAudioTrack (int playoutTrackIndex, int publishTrackIndex)=0 |
| |
| virtual int | setPlayerOption (const char *key, int64_t value)=0 |
| |
| virtual int | setPlayerOption (const char *key, const char *value)=0 |
| |
| virtual int | takeScreenshot (const char *filename)=0 |
| |
| virtual int | selectInternalSubtitle (int64_t index)=0 |
| |
| virtual int | setExternalSubtitle (const char *url)=0 |
| |
| virtual media::base::MEDIA_PLAYER_STATE | getState ()=0 |
| |
| virtual int | registerPlayerSourceObserver (IMediaPlayerSourceObserver *observer)=0 |
| |
| virtual int | unregisterPlayerSourceObserver (IMediaPlayerSourceObserver *observer)=0 |
| |
| virtual int | registerAudioFrameObserver (media::IAudioPcmFrameSink *observer)=0 |
| |
| virtual int | unregisterAudioFrameObserver (media::IAudioPcmFrameSink *observer)=0 |
| |
| virtual int | openWithAgoraCDNSrc (const char *src, int64_t startPos)=0 |
| |
| virtual int | getAgoraCDNLineCount ()=0 |
| |
| virtual int | switchAgoraCDNLineByIndex (int index)=0 |
| |
| virtual int | getCurrentAgoraCDNIndex ()=0 |
| |
| virtual int | enableAutoSwitchAgoraCDN (bool enable)=0 |
| |
| virtual int | renewAgoraCDNSrcToken (const char *token, int64_t ts)=0 |
| |
| virtual int | switchAgoraCDNSrc (const char *src, bool syncPts=false)=0 |
| |
| virtual int | switchSrc (const char *src, bool syncPts)=0 |
| |
| virtual int | preloadSrc (const char *src, int64_t startPos)=0 |
| |
| virtual int | unloadSrc (const char *src)=0 |
| |
| virtual int | playPreloadedSrc (const char *src)=0 |
| |
|
virtual void | AddRef () const =0 |
| |
|
virtual RefCountReleaseStatus | Release () const =0 |
| |
|
virtual bool | HasOneRef () const =0 |
| |
The IMediaPlayerSource class provides access to a media player source. To playout multiple media sources simultaneously, create multiple media player source objects.
◆ getSourceId()
| virtual int agora::rtc::IMediaPlayerSource::getSourceId |
( |
| ) |
const |
|
pure virtual |
Gets the unique source ID of the media player source.
- Returns
- @technical preview
- >=0: The source ID of this media player source.
- < 0: Failure.
◆ open()
| virtual int agora::rtc::IMediaPlayerSource::open |
( |
const char * |
url, |
|
|
int64_t |
startPos |
|
) |
| |
|
pure virtual |
Opens a media file with a specified URL. @technical preview
- Parameters
-
| url | The path of the media file. Both the local path and online path are supported. |
| startPos | The starting position (ms) for playback. Default value is 0. |
- Returns
- 0: Success.
- < 0: Failure.
◆ openWithMediaSource()
Opens a media file with a media file source. @technical preview
- Parameters
-
| source | Media file source that you want to play, see MediaSource |
- Returns
- 0: Success.
- < 0: Failure.
◆ play()
| virtual int agora::rtc::IMediaPlayerSource::play |
( |
| ) |
|
|
pure virtual |
Plays the media file. @technical preview
- Returns
- 0: Success.
- < 0: Failure.
◆ pause()
| virtual int agora::rtc::IMediaPlayerSource::pause |
( |
| ) |
|
|
pure virtual |
Pauses the playback. @technical preview
- Returns
- 0: Success.
- < 0: Failure.
◆ stop()
| virtual int agora::rtc::IMediaPlayerSource::stop |
( |
| ) |
|
|
pure virtual |
Stops the playback. @technical preview
- Returns
- 0: Success.
- < 0: Failure.
◆ resume()
| virtual int agora::rtc::IMediaPlayerSource::resume |
( |
| ) |
|
|
pure virtual |
Resumes the playback. @technical preview
- Returns
- 0: Success.
- < 0: Failure.
◆ seek()
| virtual int agora::rtc::IMediaPlayerSource::seek |
( |
int64_t |
newPos | ) |
|
|
pure virtual |
Sets the playback position of the media file. @technical preview
- Parameters
-
| newPos | The new playback position (ms). |
- Returns
- 0: Success.
- < 0: Failure.
◆ getDuration()
| virtual int agora::rtc::IMediaPlayerSource::getDuration |
( |
int64_t & |
duration | ) |
|
|
pure virtual |
Gets the duration of the media file. @technical preview
- Parameters
-
| [out] | duration | A reference to the duration of the media file. |
- Returns
- 0: Success.
- < 0: Failure.
◆ getPlayPosition()
| virtual int agora::rtc::IMediaPlayerSource::getPlayPosition |
( |
int64_t & |
pos | ) |
|
|
pure virtual |
Gets the current playback position of the media file. @technical preview
- Parameters
-
| [out] | pos | A reference to the current playback position (ms). |
- Returns
-
◆ getStreamCount()
| virtual int agora::rtc::IMediaPlayerSource::getStreamCount |
( |
int64_t & |
count | ) |
|
|
pure virtual |
Gets the number of the media streams in the media source. @technical preview
- Parameters
-
| [out] | count | The number of the media streams in the media source. |
- Returns
-
◆ getStreamInfo()
Gets the detailed information of a media stream. @technical preview
- Parameters
-
| index | The index of the media stream. |
| [out] | info | The detailed information of the media stream. See PlayerStreamInfo for details. |
- Returns
-
◆ setLoopCount()
| virtual int agora::rtc::IMediaPlayerSource::setLoopCount |
( |
int64_t |
loopCount | ) |
|
|
pure virtual |
Sets whether to loop the media file for playback. @technical preview
- Parameters
-
| loopCount | The number of times of looping the media file.
- 0: Play the media file once.
- 1: Play the media file twice.
- -1: Play the media file in a loop indefinitely, until stop is called.
|
- Returns
-
◆ setPlaybackSpeed()
| virtual int agora::rtc::IMediaPlayerSource::setPlaybackSpeed |
( |
int |
speed | ) |
|
|
pure virtual |
Changes the playback speed. @technical preview
- Parameters
-
| speed | The playback speed ref [50-400]. |
- Returns
-
◆ selectAudioTrack()
| virtual int agora::rtc::IMediaPlayerSource::selectAudioTrack |
( |
int64_t |
index | ) |
|
|
pure virtual |
Selects an audio track of the media file for playback. @technical preview
- Parameters
-
| index | The index of the audio track in media file. |
- Returns
-
◆ selectMultiAudioTrack()
| virtual int agora::rtc::IMediaPlayerSource::selectMultiAudioTrack |
( |
int |
playoutTrackIndex, |
|
|
int |
publishTrackIndex |
|
) |
| |
|
pure virtual |
Selects multi audio track of the media file for playback or publish to channel. @technical preview
- Parameters
-
| playoutTrackIndex | The index of the audio track in media file for local playback. |
| publishTrackIndex | The index of the audio track in the media file published to the remote. |
- Note
- You can obtain the streamIndex of the audio track by calling getStreamInfo.. If you want to use selectMultiAudioTrack, you need to open the media file with openWithMediaSource and set enableMultiAudioTrack to true.
- Returns
- 0: Success.
- < 0: Failure. See MEDIA_PLAYER_REASON.
- -2: Invalid argument. Argument must be greater than or equal to zero.
- -8: Invalid State.You must open the media file with openWithMediaSource and set enableMultiAudioTrack to true
◆ setPlayerOption() [1/2]
| virtual int agora::rtc::IMediaPlayerSource::setPlayerOption |
( |
const char * |
key, |
|
|
int64_t |
value |
|
) |
| |
|
pure virtual |
Changes the player option before playing a file. @technical preview
- Parameters
-
| key | The key of the option paramemter. |
| value | The value of option parameter. |
- Returns
-
◆ setPlayerOption() [2/2]
| virtual int agora::rtc::IMediaPlayerSource::setPlayerOption |
( |
const char * |
key, |
|
|
const char * |
value |
|
) |
| |
|
pure virtual |
Changes the player option before playing a file. @technical preview
- Parameters
-
| key | The key of the option paramemter. |
| value | The value of option parameter. |
- Returns
-
◆ takeScreenshot()
| virtual int agora::rtc::IMediaPlayerSource::takeScreenshot |
( |
const char * |
filename | ) |
|
|
pure virtual |
Takes a screenshot when playing a video file. @technical preview
- Parameters
-
| filename | The filename of the screenshot file. |
- Returns
-
◆ selectInternalSubtitle()
| virtual int agora::rtc::IMediaPlayerSource::selectInternalSubtitle |
( |
int64_t |
index | ) |
|
|
pure virtual |
Selects internal subtitles for a video file. @technical preview
- Parameters
-
| index | The index of the internal subtitles. |
- Returns
-
◆ setExternalSubtitle()
| virtual int agora::rtc::IMediaPlayerSource::setExternalSubtitle |
( |
const char * |
url | ) |
|
|
pure virtual |
Sets an external subtitle file for a video file. @technical preview
- Parameters
-
| url | The URL of the subtitle file. |
- Returns
-
◆ getState()
| virtual media::base::MEDIA_PLAYER_STATE agora::rtc::IMediaPlayerSource::getState |
( |
| ) |
|
|
pure virtual |
Gets the playback state. @technical preview
- Returns
- The current playback state. See MEDIA_PLAYER_STATE for details.
◆ registerPlayerSourceObserver()
Registers a media player source observer.
@technical preview Once the media player source observer is registered, you can use the observer to monitor the state change of the media player.
- Parameters
-
- Returns
-
◆ unregisterPlayerSourceObserver()
Releases the media player source observer. @technical preview
- Parameters
-
- Returns
-
◆ registerAudioFrameObserver()
Registers the audio frame observer. @technical preview
- Parameters
-
| observer | The pointer to the observer object. |
- Returns
-
◆ unregisterAudioFrameObserver()
Releases the audio frame observer. @technical preview
- Parameters
-
| observer | The pointer to the observer object. |
- Returns
-
◆ openWithAgoraCDNSrc()
| virtual int agora::rtc::IMediaPlayerSource::openWithAgoraCDNSrc |
( |
const char * |
src, |
|
|
int64_t |
startPos |
|
) |
| |
|
pure virtual |
Open the Agora CDN media source. @technical preview
- Parameters
-
| src | The src of the media file that you want to play. |
| startPos | The playback position (ms). |
- Deprecated:
- 4.6.0
- Returns
- 0: Success.
- < 0: Failure.
◆ getAgoraCDNLineCount()
| virtual int agora::rtc::IMediaPlayerSource::getAgoraCDNLineCount |
( |
| ) |
|
|
pure virtual |
Gets the number of Agora CDN lines. @technical preview
- Deprecated:
- 4.6.0
- Returns
- > 0: number of CDN.
- <= 0: Failure.
◆ switchAgoraCDNLineByIndex()
| virtual int agora::rtc::IMediaPlayerSource::switchAgoraCDNLineByIndex |
( |
int |
index | ) |
|
|
pure virtual |
Switch Agora CDN lines. @technical preview
- Deprecated:
- 4.6.0
- Parameters
-
| index | Specific CDN line index. |
- Returns
- 0: Success.
- < 0: Failure.
◆ getCurrentAgoraCDNIndex()
| virtual int agora::rtc::IMediaPlayerSource::getCurrentAgoraCDNIndex |
( |
| ) |
|
|
pure virtual |
Gets the line of the current CDN. @technical preview
- Deprecated:
- 4.6.0
- Returns
- >= 0: Specific line.
- < 0: Failure.
◆ enableAutoSwitchAgoraCDN()
| virtual int agora::rtc::IMediaPlayerSource::enableAutoSwitchAgoraCDN |
( |
bool |
enable | ) |
|
|
pure virtual |
Enable automatic CDN line switching. @technical preview
- Deprecated:
- 4.6.0
- Parameters
-
- Returns
- 0: Success.
- < 0: Failure.
◆ renewAgoraCDNSrcToken()
| virtual int agora::rtc::IMediaPlayerSource::renewAgoraCDNSrcToken |
( |
const char * |
token, |
|
|
int64_t |
ts |
|
) |
| |
|
pure virtual |
Update the CDN source token and timestamp. @technical preview
- Deprecated:
- 4.6.0
- Parameters
-
- Returns
- 0: Success.
- < 0: Failure.
◆ switchAgoraCDNSrc()
| virtual int agora::rtc::IMediaPlayerSource::switchAgoraCDNSrc |
( |
const char * |
src, |
|
|
bool |
syncPts = false |
|
) |
| |
|
pure virtual |
Switch the CDN source when open a media through "openWithAgoraCDNSrc" API @technical preview
- Deprecated:
- 4.6.0
- Parameters
-
| src | Specific src. |
| syncPts | Live streaming must be set to false. |
- Returns
- 0: Success.
- < 0: Failure.
◆ switchSrc()
| virtual int agora::rtc::IMediaPlayerSource::switchSrc |
( |
const char * |
src, |
|
|
bool |
syncPts |
|
) |
| |
|
pure virtual |
Switch the media source when open a media through "open" API @technical preview
- Parameters
-
| src | Specific src. |
| syncPts | Live streaming must be set to false. |
- Returns
- 0: Success.
- < 0: Failure.
◆ preloadSrc()
| virtual int agora::rtc::IMediaPlayerSource::preloadSrc |
( |
const char * |
src, |
|
|
int64_t |
startPos |
|
) |
| |
|
pure virtual |
Preload a media source @technical preview
- Parameters
-
| src | Specific src. |
| startPos | The starting position (ms) for playback. Default value is 0. |
- Returns
- 0: Success.
- < 0: Failure.
◆ unloadSrc()
| virtual int agora::rtc::IMediaPlayerSource::unloadSrc |
( |
const char * |
src | ) |
|
|
pure virtual |
Unload a preloaded media source @technical preview
- Parameters
-
- Returns
- 0: Success.
- < 0: Failure.
◆ playPreloadedSrc()
| virtual int agora::rtc::IMediaPlayerSource::playPreloadedSrc |
( |
const char * |
src | ) |
|
|
pure virtual |
Play a pre-loaded media source @technical preview
- Parameters
-
- Returns
- 0: Success.
- < 0: Failure.