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"
10 #import "AgoraRtcAudioSpectrumDelegate.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
19 @protocol AgoraRtcMediaPlayerAudioFrameDelegate;
20 @protocol AgoraRtcMediaPlayerVideoFrameDelegate;
21
22 NS_ASSUME_NONNULL_BEGIN
23 @protocol AgoraRtcMediaPlayerProtocol <NSObject>
24
31 - (int)getMediaPlayerId NS_SWIFT_NAME(getMediaPlayerId());
39 - (int)open:(NSString *)url startPos:(NSInteger)startPos NS_SWIFT_NAME(open(_:startPos:));
40
41
49 - (int)openWithMediaSource:(AgoraMediaSource *)source NS_SWIFT_NAME(open(with:));
50
59 - (int)openWithAgoraCDNSrc:(NSString *)src startPos:(NSInteger)startPos NS_SWIFT_NAME(open(withAgoraCDNSrc:startPos:));
60
67 - (int)getAgoraCDNLineCount NS_SWIFT_NAME(getAgoraCDNLineCount());
68
76 - (int)switchAgoraCDNLineByIndex:(int)index NS_SWIFT_NAME(switchAgoraCDNLine(by:));
77
84 - (int)getCurrentAgoraCDNIndex NS_SWIFT_NAME(getCurrentAgoraCDNIndex());
85
93 - (int)enableAutoSwitchAgoraCDN:(BOOL)enable NS_SWIFT_NAME(enableAutoSwitchAgoraCDN(_:));
94
103 - (int)renewAgoraCDNSrcToken:(NSString *)token ts:(NSInteger)ts NS_SWIFT_NAME(renewAgoraCDNSrcToken(_:ts:));
104
113 - (int)switchAgoraCDNSrc:(NSString *)src syncPts:(BOOL)syncPts NS_SWIFT_NAME(switchAgoraCDNSrc(_:syncPts:));
114
121 - (int)play NS_SWIFT_NAME(play());
122
126 - (int)pause NS_SWIFT_NAME(pause());
127
131 - (int)stop NS_SWIFT_NAME(stop());
132
136 - (int)resume NS_SWIFT_NAME(resume());
137
145 - (int)seekToPosition:(NSInteger)position NS_SWIFT_NAME(seek(toPosition:));
146
158 - (int)setAudioPitch:(NSInteger)pitch NS_SWIFT_NAME(setAudioPitch(_:));
159
163 - (NSInteger)getDuration NS_SWIFT_NAME(getDuration());
167 - (NSInteger)getPosition NS_SWIFT_NAME(getPosition());
171 - (NSInteger)getStreamCount NS_SWIFT_NAME(getStreamCount());
172
181 - (AgoraRtcMediaStreamInfo *_Nullable)getStreamByIndex:(int)index NS_SWIFT_NAME(getStreamBy(_:));
182
193 - (int)setLoopCount:(int)loopCount NS_SWIFT_NAME(setLoopCount(_:));
194
202 - (int)setPlaybackSpeed:(int)speed NS_SWIFT_NAME(setPlaybackSpeed(_:));
203
211 - (int)selectAudioTrack:(int)index NS_SWIFT_NAME(selectAudioTrack(_:));
212
228 - (int)selectMultiAudioTrack:(NSInteger)playoutTrackIndex publishTrackIndex:(NSInteger)publishTrackIndex NS_SWIFT_NAME(selectMultiAudioTrack(_:publishTrackIndex:));
229
237 - (int)takeScreenshot:(NSString *)filename NS_SWIFT_NAME(takeScreenshot(_:));
238
246 - (int)selectInternalSubtitle:(int)index NS_SWIFT_NAME(selectInternalSubtitle(_:));
247
255 - (int)setExternalSubtitle:(NSString *)url NS_SWIFT_NAME(setExternalSubtitle(_:));
256
263 - (AgoraMediaPlayerState)getPlayerState NS_SWIFT_NAME(getPlayerState());
264
273 - (int)mute:(bool)isMute NS_SWIFT_NAME(mute(_:));
274
280 - (BOOL)getMute NS_SWIFT_NAME(getMute());
281
292 - (int)adjustPlayoutVolume:(int)volume NS_SWIFT_NAME(adjustPlayoutVolume(_:));
293
299 - (int)getPlayoutVolume NS_SWIFT_NAME(getPlayoutVolume());
300
304 - (int)adjustPublishSignalVolume:(int)volume NS_SWIFT_NAME(adjustPublishSignalVolume(_:));
305
309 - (int)getPublishSignalVolume NS_SWIFT_NAME(getPublishSignalVolume());
310
321 - (int)setPlayerOption:(NSString *)key value:(NSInteger)value NS_SWIFT_NAME(setPlayerOption(_:value:));
322
333 - (int)setPlayerOptionString:(NSString *)key value:(NSString *)value NS_SWIFT_NAME(setPlayerOptionString(_:value:));
334
338 - (int)setView:(View *_Nullable)view NS_SWIFT_NAME(setView(_:));
339
346 - (int)setRenderMode:(AgoraMediaPlayerRenderMode)mode NS_SWIFT_NAME(setRenderMode(_:));
347
353 - (NSString *)getPlaySrc NS_SWIFT_NAME(getPlaySrc());
354
363 - (int)switchSrc:(NSString *)src syncPts:(BOOL)syncPts NS_SWIFT_NAME(switchSrc(_:syncPts:));
364
373 - (int)preloadSrc:(NSString *)src startPos:(int)startPos NS_SWIFT_NAME(preloadSrc(_:startPos:));
374
382 - (int)unloadSrc:(NSString *)src NS_SWIFT_NAME(unloadSrc(_:));
383
391 - (int)playPreloadedSrc:(NSString *)src NS_SWIFT_NAME(playPreloadedSrc(_:));
392
400 - (int)setAudioDualMonoMode:(AgoraAudioDualMonoMode)mode NS_SWIFT_NAME(setAudioDualMonoMode(_:));
401
414 - (int)openWithCustomSourceAtStartPos:(NSInteger)startPos
415 withPlayerOnReadData:(AgoraRtcMediaPlayerCustomSourceOnReadCallback)onReadDataCallback
416 andPlayerOnSeek:(AgoraRtcMediaPlayerCustomSourceOnSeekCallback)onSeekCallback NS_SWIFT_NAME(openWithCustomSourceAtStartPos(_:withPlayerOnReadData:andPlayerOnSeek:)) __deprecated;
417
428 - (int)setSpatialAudioParams:(AgoraSpatialAudioParams* _Nonnull)params NS_SWIFT_NAME(setSpatialAudioParams(_:));
429
430 #pragma mark Callback Audio PCM Frame
431
440 - (BOOL)setAudioFrameDelegate:(id<AgoraRtcMediaPlayerAudioFrameDelegate> _Nullable)delegate NS_SWIFT_NAME(setAudioFrameDelegate(_:));
441
442 #pragma mark Callback Video Frame
443
452 - (BOOL)setVideoFrameDelegate:(id<AgoraRtcMediaPlayerVideoFrameDelegate> _Nullable)delegate NS_SWIFT_NAME(setVideoFrameDelegate(_:));
453
454 - (int)registerMediaPlayerAudioSpectrumDelegate:(id<AgoraAudioSpectrumDelegate> _Nullable)delegate
455 intervalInMS:(NSUInteger)intervalInMS NS_SWIFT_NAME(registerMediaPlayerAudioSpectrumDelegate(_:intervalInMS:));
456
457 - (int)unregisterMediaPlayerAudioSpectrumDelegate:(id<AgoraAudioSpectrumDelegate> _Nullable)delegate NS_SWIFT_NAME(unregisterMediaPlayerAudioSpectrumDelegate(_:));
458 @end
459
460
461 @protocol AgoraRtcMediaPlayerCacheManagerProtocol <NSObject>
462
467 + (instancetype)sharedInstance NS_SWIFT_NAME(sharedInstance());
474 - (int)removeAllCaches NS_SWIFT_NAME(removeAllCaches());
481 - (int)removeOldCache NS_SWIFT_NAME(removeOldCache());
489 - (int)removeCacheByUri:(NSString *)uri NS_SWIFT_NAME(removeCache(byUri:));
497 - (int)setCacheDir:(NSString *)cacheDir NS_SWIFT_NAME(setCacheDir(_:));
505 - (int)setMaxCacheFileCount:(NSInteger)count NS_SWIFT_NAME(setMaxCacheFileCount(_:));
513 - (int)setMaxCacheFileSize:(NSInteger)cacheSize NS_SWIFT_NAME(setMaxCacheFileSize(_:));
521 - (int)enableAutoRemoveCache:(BOOL)enable NS_SWIFT_NAME(enableAutoRemoveCache(_:));
526 - (NSString *)cacheDir NS_SWIFT_NAME(cacheDir());
533 - (NSInteger)maxCacheFileCount NS_SWIFT_NAME(maxCacheFileCount());
540 - (NSInteger)maxCacheFileSize NS_SWIFT_NAME(maxCacheFileSize());
547 - (NSInteger)cacheFileCount NS_SWIFT_NAME(cacheFileCount());
548
549 @end
550
551 NS_ASSUME_NONNULL_END
AgoraMediaSource
Definition: AgoraObjects.h:51
AgoraMediaPlayerState
AgoraMediaPlayerState
Player state.
Definition: AgoraEnumerates.h:2735
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:33
-[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:2831
-[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:3067
AgoraRtcMediaPlayerVideoFrameDelegate-p
Definition: AgoraRtcEngineKit.h:516
-[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:48
View
UIView View
Definition: AgoraRtcMediaPlayerProtocol.h:13
-[AgoraRtcMediaPlayerCacheManagerProtocol-p cacheDir]
NSString * cacheDir()
AgoraRtcMediaPlayerCacheManagerProtocol-p
Definition: AgoraRtcMediaPlayerProtocol.h:461
-[AgoraRtcMediaPlayerProtocol-p stop]
int stop()
AgoraObjects.h
-[AgoraRtcMediaPlayerProtocol-p getMediaPlayerId]
int getMediaPlayerId()
-[AgoraRtcMediaPlayerProtocol-p getStreamCount]
NSInteger getStreamCount()
AgoraMediaPlayerRenderMode
AgoraMediaPlayerRenderMode
Definition: AgoraEnumerates.h:2789
-[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:553