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 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 
220 - (int)takeScreenshot:(NSString *)filename NS_SWIFT_NAME(takeScreenshot(_:));
221 
229 - (int)selectInternalSubtitle:(int)index NS_SWIFT_NAME(selectInternalSubtitle(_:));
230 
238 - (int)setExternalSubtitle:(NSString *)url NS_SWIFT_NAME(setExternalSubtitle(_:));
239 
247 
256 - (int)mute:(bool)isMute NS_SWIFT_NAME(mute(_:));
257 
263 - (BOOL)getMute NS_SWIFT_NAME(getMute());
264 
275 - (int)adjustPlayoutVolume:(int)volume NS_SWIFT_NAME(adjustPlayoutVolume(_:));
276 
282 - (int)getPlayoutVolume NS_SWIFT_NAME(getPlayoutVolume());
283 
287 - (int)adjustPublishSignalVolume:(int)volume NS_SWIFT_NAME(adjustPublishSignalVolume(_:));
288 
292 - (int)getPublishSignalVolume NS_SWIFT_NAME(getPublishSignalVolume());
293 
302 - (int)setPlayerOption:(NSString *)key value:(NSInteger)value NS_SWIFT_NAME(setPlayerOption(_:value:));
303 
307 - (int)setView:(View *_Nullable)view NS_SWIFT_NAME(setView(_:));
308 
315 - (int)setRenderMode:(AgoraMediaPlayerRenderMode)mode NS_SWIFT_NAME(setRenderMode(_:));
316 
322 - (NSString *)getPlaySrc NS_SWIFT_NAME(getPlaySrc());
323 
332 - (int)switchSrc:(NSString *)src syncPts:(BOOL)syncPts NS_SWIFT_NAME(switchSrc(_:syncPts:));
333 
342 - (int)preloadSrc:(NSString *)src startPos:(int)startPos NS_SWIFT_NAME(preloadSrc(_:startPos:));
343 
351 - (int)unloadSrc:(NSString *)src NS_SWIFT_NAME(unloadSrc(_:));
352 
360 - (int)playPreloadedSrc:(NSString *)src NS_SWIFT_NAME(playPreloadedSrc(_:));
361 
369 - (int)setAudioDualMonoMode:(AgoraAudioDualMonoMode)mode NS_SWIFT_NAME(setAudioDualMonoMode(_:));
370 
383 - (int)openWithCustomSourceAtStartPos:(NSInteger)startPos
384  withPlayerOnReadData:(AgoraRtcMediaPlayerCustomSourceOnReadCallback)onReadDataCallback
385  andPlayerOnSeek:(AgoraRtcMediaPlayerCustomSourceOnSeekCallback)onSeekCallback NS_SWIFT_NAME(openWithCustomSourceAtStartPos(_:withPlayerOnReadData:andPlayerOnSeek:));
386 
397 - (int)setSpatialAudioParams:(AgoraSpatialAudioParams* _Nonnull)params NS_SWIFT_NAME(setSpatialAudioParams(_:));
398 
399 #pragma mark Callback Audio PCM Frame
400 
409 - (BOOL)setAudioFrameDelegate:(id<AgoraRtcMediaPlayerAudioFrameDelegate> _Nullable)delegate NS_SWIFT_NAME(setAudioFrameDelegate(_:));
410 
411 #pragma mark Callback Video Frame
412 
421 - (BOOL)setVideoFrameDelegate:(id<AgoraRtcMediaPlayerVideoFrameDelegate> _Nullable)delegate NS_SWIFT_NAME(setVideoFrameDelegate(_:));
422 
423 - (int)registerMediaPlayerAudioSpectrumDelegate:(id<AgoraAudioSpectrumDelegate> _Nullable)delegate
424  intervalInMS:(NSUInteger)intervalInMS NS_SWIFT_NAME(registerMediaPlayerAudioSpectrumDelegate(_:intervalInMS:));
425 
426 - (int)unregisterMediaPlayerAudioSpectrumDelegate:(id<AgoraAudioSpectrumDelegate> _Nullable)delegate NS_SWIFT_NAME(unregisterMediaPlayerAudioSpectrumDelegate(_:));
427 @end
428 
429 
431 
436 + (instancetype)sharedInstance NS_SWIFT_NAME(sharedInstance());
443 - (int)removeAllCaches NS_SWIFT_NAME(removeAllCaches());
450 - (int)removeOldCache NS_SWIFT_NAME(removeOldCache());
458 - (int)removeCacheByUri:(NSString *)uri NS_SWIFT_NAME(removeCache(byUri:));
466 - (int)setCacheDir:(NSString *)cacheDir NS_SWIFT_NAME(setCacheDir(_:));
474 - (int)setMaxCacheFileCount:(NSInteger)count NS_SWIFT_NAME(setMaxCacheFileCount(_:));
482 - (int)setMaxCacheFileSize:(NSInteger)cacheSize NS_SWIFT_NAME(setMaxCacheFileSize(_:));
490 - (int)enableAutoRemoveCache:(BOOL)enable NS_SWIFT_NAME(enableAutoRemoveCache(_:));
495 - (NSString *)cacheDir NS_SWIFT_NAME(cacheDir());
502 - (NSInteger)maxCacheFileCount NS_SWIFT_NAME(maxCacheFileCount());
509 - (NSInteger)maxCacheFileSize NS_SWIFT_NAME(maxCacheFileSize());
516 - (NSInteger)cacheFileCount NS_SWIFT_NAME(cacheFileCount());
517 
518 @end
519 
520 NS_ASSUME_NONNULL_END
AgoraMediaSource
Definition: AgoraObjects.h:51
AgoraMediaPlayerState
AgoraMediaPlayerState
Player state.
Definition: AgoraEnumerates.h:2534
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:2583
-[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:2857
AgoraRtcMediaPlayerVideoFrameDelegate-p
Definition: AgoraRtcEngineKit.h:509
-[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:430
-[AgoraRtcMediaPlayerProtocol-p stop]
int stop()
AgoraObjects.h
-[AgoraRtcMediaPlayerProtocol-p getMediaPlayerId]
int getMediaPlayerId()
-[AgoraRtcMediaPlayerProtocol-p getStreamCount]
NSInteger getStreamCount()
AgoraMediaPlayerRenderMode
AgoraMediaPlayerRenderMode
Definition: AgoraEnumerates.h:2588
-[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:546