Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
IAgoraMediaPlayerSource.h
1//
2// Agora SDK
3//
4// Copyright (c) 2018 Agora.io. All rights reserved.
5//
6#pragma once // NOLINT(build/header_guard)
7
8#include "AgoraBase.h"
9#include "AgoraMediaBase.h"
10#include "AgoraMediaPlayerTypes.h"
11#include "AgoraRefPtr.h"
12
13namespace agora {
14namespace rtc {
15
16class IMediaPlayerSourceObserver;
17
22 class IMediaPlayerSource : public RefCountInterface {
23protected:
24 virtual ~IMediaPlayerSource() {}
25
26public:
27
34 virtual int getSourceId() const = 0;
35
44 virtual int open(const char* url, int64_t startPos) = 0;
45
53 virtual int openWithMediaSource(const media::base::MediaSource &source) = 0;
54
61 virtual int play() = 0;
62
69 virtual int pause() = 0;
70
77 virtual int stop() = 0;
78
85 virtual int resume() = 0;
86
94 virtual int seek(int64_t newPos) = 0;
95
103 virtual int getDuration(int64_t& duration) = 0;
104
112 virtual int getPlayPosition(int64_t& pos) = 0;
113
121 virtual int getStreamCount(int64_t& count) = 0;
122
131 virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* info) = 0;
132
143 virtual int setLoopCount(int64_t loopCount) = 0;
144
152 virtual int setPlaybackSpeed(int speed) = 0;
153
161 virtual int selectAudioTrack(int64_t index) = 0;
162
178 virtual int selectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex) = 0;
179
188 virtual int setPlayerOption(const char* key, int64_t value) = 0;
189
198 virtual int setPlayerOption(const char* key, const char* value) = 0;
199
207 virtual int takeScreenshot(const char* filename) = 0;
208
216 virtual int selectInternalSubtitle(int64_t index) = 0;
217
225 virtual int setExternalSubtitle(const char* url) = 0;
226
231 virtual media::base::MEDIA_PLAYER_STATE getState() = 0;
232
242 virtual int registerPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0;
243
251 virtual int unregisterPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0;
252
261 virtual int registerAudioFrameObserver(media::IAudioPcmFrameSink* observer) = 0;
262
270 virtual int unregisterAudioFrameObserver(media::IAudioPcmFrameSink* observer) = 0;
271
283 virtual int openWithAgoraCDNSrc(const char* src, int64_t startPos) = 0;
284
294 virtual int getAgoraCDNLineCount() = 0;
295
296
307 virtual int switchAgoraCDNLineByIndex(int index) = 0;
308
318 virtual int getCurrentAgoraCDNIndex() = 0;
319
330 virtual int enableAutoSwitchAgoraCDN(bool enable) = 0;
331
343 virtual int renewAgoraCDNSrcToken(const char* token, int64_t ts) = 0;
344
356 virtual int switchAgoraCDNSrc(const char* src, bool syncPts = false) = 0;
357
366 virtual int switchSrc(const char* src, bool syncPts) = 0;
367
376 virtual int preloadSrc(const char* src, int64_t startPos) = 0;
377
385 virtual int unloadSrc(const char* src) = 0;
386
394 virtual int playPreloadedSrc(const char* src) = 0;
395
396};
397
401 class IMediaPlayerSourceObserver {
402 public:
403 virtual ~IMediaPlayerSourceObserver() {}
404
416 virtual void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state,
417 media::base::MEDIA_PLAYER_REASON reason) = 0;
418
430 virtual void onPositionChanged(int64_t positionMs, int64_t timestampMs) = 0;
431
444 virtual void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) = 0;
445
457 virtual void onMetaData(const void* data, int length) = 0;
458
459
474 virtual void onPlayBufferUpdated(int64_t playCachedBuffer) = 0;
475
476
484 virtual void onPreloadEvent(const char* src, media::base::PLAYER_PRELOAD_EVENT event) = 0;
485
489 virtual void onCompleted() = 0;
490
497 virtual void onAgoraCDNTokenWillExpire() = 0;
498
508 virtual void onPlayerSrcInfoChanged(const media::base::SrcInfo& from, const media::base::SrcInfo& to) = 0;
509
520 virtual void onPlayerInfoUpdated(const media::base::PlayerUpdatedInfo& info) = 0;
521
532 virtual void onPlayerCacheStats(const media::base::CacheStatistics& stats) {
533 (void)stats;
534 }
535
546 virtual void onPlayerPlaybackStats(const media::base::PlayerPlaybackStats& stats) {
547 (void)stats;
548 }
549
560 virtual void onAudioVolumeIndication(int volume) = 0;
561};
562
563} //namespace rtc
564} // namespace agora
agora::RefCountInterface
Definition AgoraRefPtr.h:31
agora::media::IAudioPcmFrameSink
Definition AgoraMediaBase.h:1395
agora::rtc::IMediaPlayerSource
Definition IAgoraMediaPlayerSource.h:22
agora::rtc::IMediaPlayerSource::selectInternalSubtitle
virtual int selectInternalSubtitle(int64_t index)=0
agora::rtc::IMediaPlayerSource::registerPlayerSourceObserver
virtual int registerPlayerSourceObserver(IMediaPlayerSourceObserver *observer)=0
agora::rtc::IMediaPlayerSource::getState
virtual media::base::MEDIA_PLAYER_STATE getState()=0
agora::rtc::IMediaPlayerSource::openWithMediaSource
virtual int openWithMediaSource(const media::base::MediaSource &source)=0
agora::rtc::IMediaPlayerSource::getSourceId
virtual int getSourceId() const =0
agora::rtc::IMediaPlayerSource::openWithAgoraCDNSrc
virtual int openWithAgoraCDNSrc(const char *src, int64_t startPos)=0
agora::rtc::IMediaPlayerSource::selectMultiAudioTrack
virtual int selectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex)=0
agora::rtc::IMediaPlayerSource::unregisterPlayerSourceObserver
virtual int unregisterPlayerSourceObserver(IMediaPlayerSourceObserver *observer)=0
agora::rtc::IMediaPlayerSource::takeScreenshot
virtual int takeScreenshot(const char *filename)=0
agora::rtc::IMediaPlayerSource::stop
virtual int stop()=0
agora::rtc::IMediaPlayerSource::preloadSrc
virtual int preloadSrc(const char *src, int64_t startPos)=0
agora::rtc::IMediaPlayerSource::~IMediaPlayerSource
virtual ~IMediaPlayerSource()
Definition IAgoraMediaPlayerSource.h:24
agora::rtc::IMediaPlayerSource::getDuration
virtual int getDuration(int64_t &duration)=0
agora::rtc::IMediaPlayerSource::setPlayerOption
virtual int setPlayerOption(const char *key, int64_t value)=0
agora::rtc::IMediaPlayerSource::setPlaybackSpeed
virtual int setPlaybackSpeed(int speed)=0
agora::rtc::IMediaPlayerSource::renewAgoraCDNSrcToken
virtual int renewAgoraCDNSrcToken(const char *token, int64_t ts)=0
agora::rtc::IMediaPlayerSource::playPreloadedSrc
virtual int playPreloadedSrc(const char *src)=0
agora::rtc::IMediaPlayerSource::switchSrc
virtual int switchSrc(const char *src, bool syncPts)=0
agora::rtc::IMediaPlayerSource::unloadSrc
virtual int unloadSrc(const char *src)=0
agora::rtc::IMediaPlayerSource::getStreamInfo
virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo *info)=0
agora::rtc::IMediaPlayerSource::switchAgoraCDNLineByIndex
virtual int switchAgoraCDNLineByIndex(int index)=0
agora::rtc::IMediaPlayerSource::setExternalSubtitle
virtual int setExternalSubtitle(const char *url)=0
agora::rtc::IMediaPlayerSource::getAgoraCDNLineCount
virtual int getAgoraCDNLineCount()=0
agora::rtc::IMediaPlayerSource::setLoopCount
virtual int setLoopCount(int64_t loopCount)=0
agora::rtc::IMediaPlayerSource::pause
virtual int pause()=0
agora::rtc::IMediaPlayerSource::open
virtual int open(const char *url, int64_t startPos)=0
agora::rtc::IMediaPlayerSource::enableAutoSwitchAgoraCDN
virtual int enableAutoSwitchAgoraCDN(bool enable)=0
agora::rtc::IMediaPlayerSource::registerAudioFrameObserver
virtual int registerAudioFrameObserver(media::IAudioPcmFrameSink *observer)=0
agora::rtc::IMediaPlayerSource::seek
virtual int seek(int64_t newPos)=0
agora::rtc::IMediaPlayerSource::selectAudioTrack
virtual int selectAudioTrack(int64_t index)=0
agora::rtc::IMediaPlayerSource::getPlayPosition
virtual int getPlayPosition(int64_t &pos)=0
agora::rtc::IMediaPlayerSource::resume
virtual int resume()=0
agora::rtc::IMediaPlayerSource::setPlayerOption
virtual int setPlayerOption(const char *key, const char *value)=0
agora::rtc::IMediaPlayerSource::switchAgoraCDNSrc
virtual int switchAgoraCDNSrc(const char *src, bool syncPts=false)=0
agora::rtc::IMediaPlayerSource::unregisterAudioFrameObserver
virtual int unregisterAudioFrameObserver(media::IAudioPcmFrameSink *observer)=0
agora::rtc::IMediaPlayerSource::play
virtual int play()=0
agora::rtc::IMediaPlayerSource::getStreamCount
virtual int getStreamCount(int64_t &count)=0
agora::rtc::IMediaPlayerSource::getCurrentAgoraCDNIndex
virtual int getCurrentAgoraCDNIndex()=0
agora::rtc::IMediaPlayerSourceObserver
Definition IAgoraMediaPlayerSource.h:401
agora::rtc::IMediaPlayerSourceObserver::onPlayerSourceStateChanged
virtual void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason)=0
Reports the changes of playback state.
agora::rtc::IMediaPlayerSourceObserver::~IMediaPlayerSourceObserver
virtual ~IMediaPlayerSourceObserver()
Definition IAgoraMediaPlayerSource.h:403
agora::rtc::IMediaPlayerSourceObserver::onAgoraCDNTokenWillExpire
virtual void onAgoraCDNTokenWillExpire()=0
AgoraCDN Token has expired and needs to be set up with renewAgoraCDNSrcToken(const char* src).
agora::rtc::IMediaPlayerSourceObserver::onPlayerPlaybackStats
virtual void onPlayerPlaybackStats(const media::base::PlayerPlaybackStats &stats)
The statistics of the media file being played.
Definition IAgoraMediaPlayerSource.h:546
agora::rtc::IMediaPlayerSourceObserver::onPlayBufferUpdated
virtual void onPlayBufferUpdated(int64_t playCachedBuffer)=0
Reports the playback duration that the buffered data can support.
agora::rtc::IMediaPlayerSourceObserver::onPlayerCacheStats
virtual void onPlayerCacheStats(const media::base::CacheStatistics &stats)
Reports the statistics of the media file being cached.
Definition IAgoraMediaPlayerSource.h:532
agora::rtc::IMediaPlayerSourceObserver::onPreloadEvent
virtual void onPreloadEvent(const char *src, media::base::PLAYER_PRELOAD_EVENT event)=0
Reports the events of preloaded media resources.
agora::rtc::IMediaPlayerSourceObserver::onPlayerEvent
virtual void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char *message)=0
Reports the player events.
agora::rtc::IMediaPlayerSourceObserver::onPlayerInfoUpdated
virtual void onPlayerInfoUpdated(const media::base::PlayerUpdatedInfo &info)=0
Occurs when information related to the media player changes.
agora::rtc::IMediaPlayerSourceObserver::onMetaData
virtual void onMetaData(const void *data, int length)=0
Occurs when the media metadata is received.
agora::rtc::IMediaPlayerSourceObserver::onPlayerSrcInfoChanged
virtual void onPlayerSrcInfoChanged(const media::base::SrcInfo &from, const media::base::SrcInfo &to)=0
Occurs when the video bitrate of the media resource changes.
agora::rtc::IMediaPlayerSourceObserver::onCompleted
virtual void onCompleted()=0
Occurs when one playback of the media file is completed.
agora::rtc::IMediaPlayerSourceObserver::onAudioVolumeIndication
virtual void onAudioVolumeIndication(int volume)=0
Reports the volume of the media player.
agora::rtc::IMediaPlayerSourceObserver::onPositionChanged
virtual void onPositionChanged(int64_t positionMs, int64_t timestampMs)=0
Reports the playback progress of the media file.
agora::media::base::MEDIA_PLAYER_EVENT
MEDIA_PLAYER_EVENT
Media player events.
Definition AgoraMediaPlayerTypes.h:214
agora::media::base::PLAYER_PRELOAD_EVENT
PLAYER_PRELOAD_EVENT
Events that occur when media resources are preloaded.
Definition AgoraMediaPlayerTypes.h:289
agora::media::base::MEDIA_PLAYER_STATE
MEDIA_PLAYER_STATE
The playback state.
Definition AgoraMediaPlayerTypes.h:53
agora::media::base::MEDIA_PLAYER_REASON
MEDIA_PLAYER_REASON
Reasons for the changes in the media player status.
Definition AgoraMediaPlayerTypes.h:116
agora::rtc
Definition AgoraExtensions.h:5
agora
Definition AgoraAtomicOps.h:21
agora::media::base::CacheStatistics
Statistics about the media files being cached.
Definition AgoraMediaPlayerTypes.h:423
agora::media::base::MediaSource
Information related to the media file to be played and the playback scenario configurations.
Definition AgoraMediaPlayerTypes.h:560
agora::media::base::PlayerPlaybackStats
The information of the media file being played.
Definition AgoraMediaPlayerTypes.h:441
agora::media::base::PlayerStreamInfo
The detailed information of the media stream.
Definition AgoraMediaPlayerTypes.h:307
agora::media::base::PlayerUpdatedInfo
Information related to the media player.
Definition AgoraMediaPlayerTypes.h:463
agora::media::base::SrcInfo
Information about the video bitrate of the media resource being played.
Definition AgoraMediaPlayerTypes.h:393