Agora RTC Objective-C API Reference  Refactor
AgoraRtcMediaPlayerProtocol.h
Go to the documentation of this file.
1 //
2 // AgoraRtcMediaPlayerProtocol.h
3 // AgoraRtcMediaPlayerProtocol
4 //
5 // Copyright (c) 2020 Agora. All rights reserved.
6 //
7 
8 #import <Foundation/Foundation.h>
9 #import "AgoraObjects.h"
11 #if TARGET_OS_IPHONE
12 #import <UIKit/UIKit.h>
13 typedef UIView View;
14 #elif TARGET_OS_MAC
15 #import <AppKit/AppKit.h>
16 typedef NSView View;
17 #endif
18 
21 
22 NS_ASSUME_NONNULL_BEGIN
23 @protocol AgoraRtcMediaPlayerProtocol <NSObject>
24 
31 - (int)getMediaPlayerId;
39 - (int)open:(NSString *)url startPos:(NSInteger)startPos;
40 
41 
49 - (int)openWithMediaSource:(AgoraMediaSource *)source;
50 
59 - (int)openWithAgoraCDNSrc:(NSString *)src startPos:(NSInteger)startPos;
60 
68 
76 - (int)switchAgoraCDNLineByIndex:(int)index;
77 
85 
93 - (int)enableAutoSwitchAgoraCDN:(BOOL)enable;
94 
103 - (int)renewAgoraCDNSrcToken:(NSString *)token ts:(NSInteger)ts;
104 
113 - (int)switchAgoraCDNSrc:(NSString *)src syncPts:(BOOL)syncPts;
114 
121 - (int)play;
122 
126 - (int)pause;
127 
131 - (int)stop;
132 
136 - (int)resume;
137 
145 - (int)seekToPosition:(NSInteger)position;
146 
158 - (int)setAudioPitch:(NSInteger)pitch;
159 
163 - (NSInteger)getDuration;
167 - (NSInteger)getPosition;
171 - (NSInteger)getStreamCount;
172 
181 - (AgoraRtcMediaStreamInfo *_Nullable)getStreamByIndex:(int)index;
182 
193 - (int)setLoopCount:(int)loopCount;
194 
202 - (int)setPlaybackSpeed:(int)speed;
203 
211 - (int)selectAudioTrack:(int)index;
212 
220 - (int)takeScreenshot:(NSString *)filename;
221 
229 - (int)selectInternalSubtitle:(int)index;
230 
238 - (int)setExternalSubtitle:(NSString *)url;
239 
247 
256 - (int)mute:(bool)isMute;
257 
263 - (BOOL)getMute;
264 
275 - (int)adjustPlayoutVolume:(int)volume;
276 
282 - (int)getPlayoutVolume;
283 
287 - (int)adjustPublishSignalVolume:(int)volume;
288 
293 
302 - (int)setPlayerOption:(NSString *)key value:(NSInteger)value;
303 
307 - (int)setView:(View *_Nullable)view;
308 
315 - (int)setRenderMode:(AgoraMediaPlayerRenderMode)mode;
316 
322 - (NSString *)getPlaySrc;
323 
332 - (int)switchSrc:(NSString *)src syncPts:(BOOL)syncPts;
333 
342 - (int)preloadSrc:(NSString *)src startPos:(int)startPos;
343 
351 - (int)unloadSrc:(NSString *)src;
352 
360 - (int)playPreloadedSrc:(NSString *)src;
361 
369 - (int)setAudioDualMonoMode:(AgoraAudioDualMonoMode)mode;
370 
383 - (int)openWithCustomSourceAtStartPos:(NSInteger)startPos
384  withPlayerOnReadData:(AgoraRtcMediaPlayerCustomSourceOnReadCallback)onReadDataCallback
385  andPlayerOnSeek:(AgoraRtcMediaPlayerCustomSourceOnSeekCallback)onSeekCallback;
386 
397 - (int)setSpatialAudioParams:(AgoraSpatialAudioParams* _Nonnull)params;
398 
399 #pragma mark Callback Audio PCM Frame
400 
409 - (BOOL)setAudioFrameDelegate:(id<AgoraRtcMediaPlayerAudioFrameDelegate> _Nullable)delegate;
410 
411 #pragma mark Callback Video Frame
412 
421 - (BOOL)setVideoFrameDelegate:(id<AgoraRtcMediaPlayerVideoFrameDelegate> _Nullable)delegate;
422 
423 - (int)registerMediaPlayerAudioSpectrumDelegate:(id<AgoraAudioSpectrumDelegate> _Nullable)delegate
424  intervalInMS:(NSUInteger)intervalInMS;
425 
426 - (int)unregisterMediaPlayerAudioSpectrumDelegate:
427  (id<AgoraAudioSpectrumDelegate> _Nullable)delegate;
428 @end
429 
430 
432 
437 + (instancetype)sharedInstance;
444 - (int)removeAllCaches;
451 - (int)removeOldCache;
459 - (int)removeCacheByUri:(NSString *)uri;
467 - (int)setCacheDir:(NSString *)cacheDir;
475 - (int)setMaxCacheFileCount:(NSInteger)count;
483 - (int)setMaxCacheFileSize:(NSInteger)cacheSize;
491 - (int)enableAutoRemoveCache:(BOOL)enable;
496 - (NSString *)cacheDir;
503 - (NSInteger)maxCacheFileCount;
510 - (NSInteger)maxCacheFileSize;
517 - (NSInteger)cacheFileCount;
518 
519 @end
520 
521 NS_ASSUME_NONNULL_END
AgoraMediaSource
Definition: AgoraObjects.h:52
AgoraMediaPlayerState
AgoraMediaPlayerState
Player state.
Definition: AgoraEnumerates.h:2458
AgoraRtcMediaPlayerCustomSourceOnReadCallback
int(^ AgoraRtcMediaPlayerCustomSourceOnReadCallback)(id< AgoraRtcMediaPlayerProtocol > _Nonnull playerKit, unsigned char *_Nullable buffer, int bufferSize)
The player requests to read the data callback, you need to fill the specified length of data into the...
Definition: AgoraObjects.h:34
-[AgoraRtcMediaPlayerProtocol-p getAgoraCDNLineCount]
int getAgoraCDNLineCount()
-[AgoraRtcMediaPlayerProtocol-p getPlaySrc]
NSString * getPlaySrc()
-[AgoraRtcMediaPlayerProtocol-p getPosition]
NSInteger getPosition()
-[AgoraRtcMediaPlayerCacheManagerProtocol-p cacheFileCount]
NSInteger cacheFileCount()
-[AgoraRtcMediaPlayerCacheManagerProtocol-p removeOldCache]
int removeOldCache()
AgoraAudioSpectrumDelegate-p
Definition: AgoraRtcAudioSpectrumDelegate.h:12
View
UIView View
Definition: AgoraMediaPlayerKit.h:13
-[AgoraRtcMediaPlayerCacheManagerProtocol-p removeAllCaches]
int removeAllCaches()
AgoraRtcMediaPlayerProtocol-p
Definition: AgoraRtcMediaPlayerProtocol.h:23
AgoraRtcMediaStreamInfo
Definition: AgoraObjects.h:2519
-[AgoraRtcMediaPlayerProtocol-p resume]
int resume()
-[AgoraRtcMediaPlayerProtocol-p getMute]
BOOL getMute()
Get mute state.
-[AgoraRtcMediaPlayerProtocol-p getCurrentAgoraCDNIndex]
int getCurrentAgoraCDNIndex()
-[AgoraRtcMediaPlayerProtocol-p getPlayerState]
AgoraMediaPlayerState getPlayerState()
AgoraAudioDualMonoMode
AgoraAudioDualMonoMode
Definition: AgoraEnumerates.h:2777
AgoraRtcMediaPlayerVideoFrameDelegate-p
Definition: AgoraRtcEngineKit.h:477
-[AgoraRtcMediaPlayerProtocol-p pause]
int pause()
+[AgoraRtcMediaPlayerCacheManagerProtocol-p sharedInstance]
instancetype sharedInstance()
AgoraRtcAudioSpectrumDelegate.h
-[AgoraRtcMediaPlayerProtocol-p getPublishSignalVolume]
int getPublishSignalVolume()
get publish signal volume
-[AgoraRtcMediaPlayerCacheManagerProtocol-p maxCacheFileSize]
NSInteger maxCacheFileSize()
AgoraRtcMediaPlayerCustomSourceOnSeekCallback
long long(^ AgoraRtcMediaPlayerCustomSourceOnSeekCallback)(id< AgoraRtcMediaPlayerProtocol > _Nonnull playerKit, long long offset, int whence)
The Player seek event callback, you need to operate the corresponding stream seek operation,...
Definition: AgoraObjects.h:49
View
UIView View
Definition: AgoraRtcMediaPlayerProtocol.h:13
-[AgoraRtcMediaPlayerCacheManagerProtocol-p cacheDir]
NSString * cacheDir()
AgoraRtcMediaPlayerCacheManagerProtocol-p
Definition: AgoraRtcMediaPlayerProtocol.h:431
-[AgoraRtcMediaPlayerProtocol-p stop]
int stop()
AgoraObjects.h
-[AgoraRtcMediaPlayerProtocol-p getMediaPlayerId]
int getMediaPlayerId()
-[AgoraRtcMediaPlayerProtocol-p getStreamCount]
NSInteger getStreamCount()
AgoraMediaPlayerRenderMode
AgoraMediaPlayerRenderMode
Definition: AgoraEnumerates.h:2512
-[AgoraRtcMediaPlayerProtocol-p getPlayoutVolume]
int getPlayoutVolume()
Get the current playback volume.
-[AgoraRtcMediaPlayerProtocol-p getDuration]
NSInteger getDuration()
-[AgoraRtcMediaPlayerProtocol-p play]
int play()
-[AgoraRtcMediaPlayerCacheManagerProtocol-p maxCacheFileCount]
NSInteger maxCacheFileCount()
AgoraRtcMediaPlayerAudioFrameDelegate-p
Definition: AgoraRtcEngineKit.h:514