Agora RTC Objective-C API Reference Refactor

IAgoraMediaPlayerSource.h
Go to the documentation of this file.
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
13 namespace agora {
14 namespace rtc {
15
16 class IMediaPlayerSourceObserver;
17
22 class IMediaPlayerSource : public RefCountInterface {
23 protected:
24 virtual ~IMediaPlayerSource() {}
25
26 public:
27
34 virtual int getSourceId() const = 0;
35
44 virtual int open(const char* url, int64_t startPos) = 0;
45
55 virtual int openWithCustomSource(int64_t startPos, media::base::IMediaPlayerCustomDataProvider* provider) __deprecated = 0;
56
64 virtual int openWithMediaSource(const media::base::MediaSource &source) = 0;
65
72 virtual int play() = 0;
73
80 virtual int pause() = 0;
81
88 virtual int stop() = 0;
89
96 virtual int resume() = 0;
97
105 virtual int seek(int64_t newPos) = 0;
106
114 virtual int getDuration(int64_t& duration) = 0;
115
123 virtual int getPlayPosition(int64_t& pos) = 0;
124
132 virtual int getStreamCount(int64_t& count) = 0;
133
142 virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* info) = 0;
143
154 virtual int setLoopCount(int64_t loopCount) = 0;
155
163 virtual int setPlaybackSpeed(int speed) = 0;
164
172 virtual int selectAudioTrack(int64_t index) = 0;
173
189 virtual int selectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex) = 0;
190
199 virtual int setPlayerOption(const char* key, int64_t value) = 0;
200
209 virtual int setPlayerOption(const char* key, const char* value) = 0;
210
218 virtual int takeScreenshot(const char* filename) = 0;
219
227 virtual int selectInternalSubtitle(int64_t index) = 0;
228
236 virtual int setExternalSubtitle(const char* url) = 0;
237
242 virtual media::base::MEDIA_PLAYER_STATE getState() = 0;
243
253 virtual int registerPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0;
254
262 virtual int unregisterPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0;
263
272 virtual int registerAudioFrameObserver(media::IAudioPcmFrameSink* observer) = 0;
273
281 virtual int unregisterAudioFrameObserver(media::IAudioPcmFrameSink* observer) = 0;
282
291 virtual int openWithAgoraCDNSrc(const char* src, int64_t startPos) = 0;
292
299 virtual int getAgoraCDNLineCount() = 0;
300
301
309 virtual int switchAgoraCDNLineByIndex(int index) = 0;
310
317 virtual int getCurrentAgoraCDNIndex() = 0;
318
326 virtual int enableAutoSwitchAgoraCDN(bool enable) = 0;
327
336 virtual int renewAgoraCDNSrcToken(const char* token, int64_t ts) = 0;
337
346 virtual int switchAgoraCDNSrc(const char* src, bool syncPts = false) = 0;
347
356 virtual int switchSrc(const char* src, bool syncPts) = 0;
357
366 virtual int preloadSrc(const char* src, int64_t startPos) = 0;
367
375 virtual int unloadSrc(const char* src) = 0;
376
384 virtual int playPreloadedSrc(const char* src) = 0;
385
386 };
387
391 class IMediaPlayerSourceObserver {
392 public:
393 virtual ~IMediaPlayerSourceObserver() {}
394
402 virtual void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state,
403 media::base::MEDIA_PLAYER_ERROR ec) = 0;
404
411 virtual void onPositionChanged(int64_t position_ms) = 0;
412
423 virtual void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) = 0;
424
432 virtual void onMetaData(const void* data, int length) = 0;
433
434
440 virtual void onPlayBufferUpdated(int64_t playCachedBuffer) = 0;
441
442
448 virtual void onPreloadEvent(const char* src, media::base::PLAYER_PRELOAD_EVENT event) = 0;
449
453 virtual void onCompleted() = 0;
454
458 virtual void onAgoraCDNTokenWillExpire() = 0;
459
467 virtual void onPlayerSrcInfoChanged(const media::base::SrcInfo& from, const media::base::SrcInfo& to) = 0;
468
474 virtual void onPlayerInfoUpdated(const media::base::PlayerUpdatedInfo& info) = 0;
475
481 virtual void onAudioVolumeIndication(int volume) = 0;
482 };
483
484 } //namespace rtc
485 } // namespace agora
agora::rtc::IMediaPlayerSource::getState
virtual media::base::MEDIA_PLAYER_STATE getState()=0
agora::rtc::IMediaPlayerSource::seek
virtual int seek(int64_t newPos)=0
agora::media::IAudioPcmFrameSink
Definition: AgoraMediaBase.h:994
agora::rtc::IMediaPlayerSource::~IMediaPlayerSource
virtual ~IMediaPlayerSource()
Definition: IAgoraMediaPlayerSource.h:24
agora::rtc::IMediaPlayerSource::registerAudioFrameObserver
virtual int registerAudioFrameObserver(media::IAudioPcmFrameSink *observer)=0
AgoraBase.h
agora::rtc::IMediaPlayerSource
Definition: IAgoraMediaPlayerSource.h:22
agora::rtc::IMediaPlayerSourceObserver
Definition: IAgoraMediaPlayerSource.h:391
agora::rtc::IMediaPlayerSource::pause
virtual int pause()=0
agora::rtc::IMediaPlayerSourceObserver::onPositionChanged
virtual void onPositionChanged(int64_t position_ms)=0
Reports current playback progress.
agora::rtc::IMediaPlayerSourceObserver::onPlayerInfoUpdated
virtual void onPlayerInfoUpdated(const media::base::PlayerUpdatedInfo &info)=0
Triggered when media player information updated.
agora::rtc::IMediaPlayerSource::switchAgoraCDNLineByIndex
virtual int switchAgoraCDNLineByIndex(int index)=0
agora::media::base::PlayerUpdatedInfo
Definition: AgoraMediaPlayerTypes.h:360
agora::rtc::IMediaPlayerSource::switchAgoraCDNSrc
virtual int switchAgoraCDNSrc(const char *src, bool syncPts=false)=0
agora::media::base::MEDIA_PLAYER_EVENT
MEDIA_PLAYER_EVENT
The playback event.
Definition: AgoraMediaPlayerTypes.h:188
agora::rtc::IMediaPlayerSource::renewAgoraCDNSrcToken
virtual int renewAgoraCDNSrcToken(const char *token, int64_t ts)=0
agora::rtc::IMediaPlayerSource::play
virtual int play()=0
agora::rtc::IMediaPlayerSource::unregisterAudioFrameObserver
virtual int unregisterAudioFrameObserver(media::IAudioPcmFrameSink *observer)=0
agora::media::base::MEDIA_PLAYER_STATE
MEDIA_PLAYER_STATE
The playback state.
Definition: AgoraMediaPlayerTypes.h:54
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::IMediaPlayerSource::getStreamCount
virtual int getStreamCount(int64_t &count)=0
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::IMediaPlayerSource::takeScreenshot
virtual int takeScreenshot(const char *filename)=0
agora::media::base::IMediaPlayerCustomDataProvider
Definition: AgoraMediaPlayerTypes.h:377
agora::rtc::IMediaPlayerSourceObserver::~IMediaPlayerSourceObserver
virtual ~IMediaPlayerSourceObserver()
Definition: IAgoraMediaPlayerSource.h:393
agora::rtc::IMediaPlayerSource::resume
virtual int resume()=0
agora::rtc::IMediaPlayerSource::switchSrc
virtual int switchSrc(const char *src, bool syncPts)=0
agora::rtc::IMediaPlayerSource::setLoopCount
virtual int setLoopCount(int64_t loopCount)=0
agora::rtc::IMediaPlayerSourceObserver::onPlayerSourceStateChanged
virtual void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec)=0
Reports the playback state change.
agora::rtc::IMediaPlayerSource::registerPlayerSourceObserver
virtual int registerPlayerSourceObserver(IMediaPlayerSourceObserver *observer)=0
agora::rtc::IMediaPlayerSource::getSourceId
virtual int getSourceId() const =0
agora::rtc::IMediaPlayerSource::getPlayPosition
virtual int getPlayPosition(int64_t &pos)=0
agora::media::base::PlayerStreamInfo
The information of the media stream object.
Definition: AgoraMediaPlayerTypes.h:262
agora::rtc::IMediaPlayerSource::openWithAgoraCDNSrc
virtual int openWithAgoraCDNSrc(const char *src, int64_t startPos)=0
agora::rtc::IMediaPlayerSourceObserver::onPreloadEvent
virtual void onPreloadEvent(const char *src, media::base::PLAYER_PRELOAD_EVENT event)=0
Triggered when the player preloadSrc.
agora::rtc::IMediaPlayerSource::openWithMediaSource
virtual int openWithMediaSource(const media::base::MediaSource &source)=0
agora::rtc::IMediaPlayerSourceObserver::onMetaData
virtual void onMetaData(const void *data, int length)=0
Occurs when the metadata is received.
agora::rtc::IMediaPlayerSource::unregisterPlayerSourceObserver
virtual int unregisterPlayerSourceObserver(IMediaPlayerSourceObserver *observer)=0
agora::rtc::IMediaPlayerSourceObserver::onPlayerSrcInfoChanged
virtual void onPlayerSrcInfoChanged(const media::base::SrcInfo &from, const media::base::SrcInfo &to)=0
Reports current playback source bitrate changed.
agora::rtc::IMediaPlayerSource::openWithCustomSource
virtual int openWithCustomSource(int64_t startPos, media::base::IMediaPlayerCustomDataProvider *provider) 1=0
Open media file or stream with custom soucrce.
agora::rtc::IMediaPlayerSourceObserver::onPlayerEvent
virtual void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char *message)=0
Reports the playback event.
agora::media::base::MediaSource
Definition: AgoraMediaPlayerTypes.h:405
agora::rtc::IMediaPlayerSource::selectAudioTrack
virtual int selectAudioTrack(int64_t index)=0
agora::rtc::IMediaPlayerSource::getStreamInfo
virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo *info)=0
AgoraRefPtr.h
agora::rtc::IMediaPlayerSourceObserver::onAudioVolumeIndication
virtual void onAudioVolumeIndication(int volume)=0
Triggered every 200 millisecond ,update player current volume range [0,255].
agora::rtc::IMediaPlayerSource::unloadSrc
virtual int unloadSrc(const char *src)=0
AgoraMediaBase.h
agora::rtc::IMediaPlayerSource::selectMultiAudioTrack
virtual int selectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex)=0
agora::media::base::MEDIA_PLAYER_ERROR
MEDIA_PLAYER_ERROR
Player error code.
Definition: AgoraMediaPlayerTypes.h:108
AgoraMediaPlayerTypes.h
__deprecated
#define __deprecated
Definition: AgoraBase.h:63
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::RefCountInterface
Definition: AgoraRefPtr.h:31
agora::media::base::SrcInfo
The information of the media stream object.
Definition: AgoraMediaPlayerTypes.h:322
agora::rtc::IMediaPlayerSource::playPreloadedSrc
virtual int playPreloadedSrc(const char *src)=0
agora::rtc::IMediaPlayerSource::setPlayerOption
virtual int setPlayerOption(const char *key, const char *value)=0
agora::rtc::IMediaPlayerSource::selectInternalSubtitle
virtual int selectInternalSubtitle(int64_t index)=0
agora::media::base::PLAYER_PRELOAD_EVENT
PLAYER_PRELOAD_EVENT
The play preload another source event.
Definition: AgoraMediaPlayerTypes.h:246
agora::rtc::IMediaPlayerSourceObserver::onCompleted
virtual void onCompleted()=0
Occurs when one playback of the media file is completed.
agora::rtc::IMediaPlayerSource::setExternalSubtitle
virtual int setExternalSubtitle(const char *url)=0
agora::rtc::IMediaPlayerSource::getCurrentAgoraCDNIndex
virtual int getCurrentAgoraCDNIndex()=0
agora::rtc::IMediaPlayerSource::setPlaybackSpeed
virtual int setPlaybackSpeed(int speed)=0
agora::rtc::IMediaPlayerSource::enableAutoSwitchAgoraCDN
virtual int enableAutoSwitchAgoraCDN(bool enable)=0
agora::rtc::IMediaPlayerSource::preloadSrc
virtual int preloadSrc(const char *src, int64_t startPos)=0
agora::rtc::IMediaPlayerSource::open
virtual int open(const char *url, int64_t startPos)=0
agora::rtc::IMediaPlayerSourceObserver::onPlayBufferUpdated
virtual void onPlayBufferUpdated(int64_t playCachedBuffer)=0
Triggered when play buffer updated, once every 1 second.
agora::rtc::IMediaPlayerSource::getAgoraCDNLineCount
virtual int getAgoraCDNLineCount()=0
agora::rtc::IMediaPlayerSource::stop
virtual int stop()=0