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 
32 typedef int(^AgoraRtcMediaPlayerCustomSourceOnReadCallback)(id<AgoraRtcMediaPlayerProtocol> _Nonnull playerKit, unsigned char * _Nullable buffer, int bufferLength);
33 
47 typedef long long(^AgoraRtcMediaPlayerCustomSourceOnSeekCallback)(id<AgoraRtcMediaPlayerProtocol> _Nonnull playerKit, long long offset, int whence);
48 
49 
56 - (int)getMediaPlayerId;
64 - (int)open:(NSString *)url startPos:(NSInteger)startPos;
65 
66 
75 - (int)openWithAgoraCDNSrc:(NSString *)src startPos:(NSInteger)startPos;
76 
84 
92 - (int)switchAgoraCDNLineByIndex:(int)index;
93 
101 
109 - (int)enableAutoSwitchAgoraCDN:(BOOL)enable;
110 
119 - (int)renewAgoraCDNSrcToken:(NSString *)token ts:(NSInteger)ts;
120 
129 - (int)switchAgoraCDNSrc:(NSString *)src syncPts:(BOOL)syncPts;
130 
137 - (int)play;
138 
142 - (int)pause;
143 
147 - (int)stop;
148 
152 - (int)resume;
153 
161 - (int)seekToPosition:(NSInteger)position;
162 
174 - (int)setAudioPitch:(NSInteger)pitch;
175 
179 - (NSInteger)getDuration;
183 - (NSInteger)getPosition;
187 - (NSInteger)getStreamCount;
188 
197 - (AgoraRtcMediaStreamInfo *_Nullable)getStreamByIndex:(int)index;
198 
209 - (int)setLoopCount:(int)loopCount;
210 
218 - (int)setPlaybackSpeed:(int)speed;
219 
227 - (int)selectAudioTrack:(int)index;
228 
236 - (int)takeScreenshot:(NSString *)filename;
237 
245 - (int)selectInternalSubtitle:(int)index;
246 
254 - (int)setExternalSubtitle:(NSString *)url;
255 
263 
272 - (int)mute:(bool)isMute;
273 
279 - (BOOL)getMute;
280 
291 - (int)adjustPlayoutVolume:(int)volume;
292 
298 - (int)getPlayoutVolume;
299 
303 - (int)adjustPublishSignalVolume:(int)volume;
304 
309 
318 - (int)setPlayerOption:(NSString *)key value:(NSInteger)value;
319 
323 - (int)setView:(View *_Nullable)view;
324 
331 - (int)setRenderMode:(AgoraMediaPlayerRenderMode)mode;
332 
338 - (NSString *)getPlaySrc;
339 
348 - (int)switchSrc:(NSString *)src syncPts:(BOOL)syncPts;
349 
358 - (int)preloadSrc:(NSString *)src startPos:(int)startPos;
359 
367 - (int)unloadSrc:(NSString *)src;
368 
376 - (int)playPreloadedSrc:(NSString *)src;
377 
385 - (int)setAudioDualMonoMode:(AgoraAudioDualMonoMode)mode;
386 
398 - (int)openWithCustomSourceAtStartPos:(NSInteger)startPos
399  withPlayerOnReadData:(AgoraRtcMediaPlayerCustomSourceOnReadCallback)onReadDataCallback
400  andPlayerOnSeek:(AgoraRtcMediaPlayerCustomSourceOnSeekCallback)onSeekCallback;
401 
412 - (int)setSpatialAudioParams:(AgoraSpatialAudioParams* _Nonnull)params;
413 
414 #pragma mark Callback Audio PCM Frame
415 
424 - (BOOL)setAudioFrameDelegate:(id<AgoraRtcMediaPlayerAudioFrameDelegate> _Nullable)delegate;
425 
426 #pragma mark Callback Video Frame
427 
436 - (BOOL)setVideoFrameDelegate:(id<AgoraRtcMediaPlayerVideoFrameDelegate> _Nullable)delegate;
437 
438 - (int)registerMediaPlayerAudioSpectrumDelegate:(id<AgoraAudioSpectrumDelegate> _Nullable)delegate
439  intervalInMS:(NSUInteger)intervalInMS;
440 
441 - (int)unregisterMediaPlayerAudioSpectrumDelegate:
442  (id<AgoraAudioSpectrumDelegate> _Nullable)delegate;
443 
444 @end
445 NS_ASSUME_NONNULL_END
AgoraMediaPlayerState
AgoraMediaPlayerState
Player state.
Definition: AgoraEnumerates.h:2254
-[AgoraRtcMediaPlayerProtocol-p getAgoraCDNLineCount]
int getAgoraCDNLineCount()
-[AgoraRtcMediaPlayerProtocol-p getPlaySrc]
NSString * getPlaySrc()
-[AgoraRtcMediaPlayerProtocol-p getPosition]
NSInteger getPosition()
AgoraAudioSpectrumDelegate-p
Definition: AgoraRtcAudioSpectrumDelegate.h:12
View
UIView View
Definition: AgoraMediaPlayerKit.h:13
AgoraRtcMediaPlayerProtocol-p
Definition: AgoraRtcMediaPlayerProtocol.h:23
AgoraRtcMediaPlayerProtocol-p::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: AgoraRtcMediaPlayerProtocol.h:47
AgoraRtcMediaStreamInfo
Definition: AgoraObjects.h:2015
AgoraRtcMediaPlayerProtocol-p::AgoraRtcMediaPlayerCustomSourceOnReadCallback
int(^ AgoraRtcMediaPlayerCustomSourceOnReadCallback)(id< AgoraRtcMediaPlayerProtocol > _Nonnull playerKit, unsigned char *_Nullable buffer, int bufferLength)
The player requests to read the data callback, you need to fill the specified length of data into the...
Definition: AgoraRtcMediaPlayerProtocol.h:32
-[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:2534
AgoraRtcMediaPlayerVideoFrameDelegate-p
Definition: AgoraRtcEngineKit.h:452
-[AgoraRtcMediaPlayerProtocol-p pause]
int pause()
AgoraRtcAudioSpectrumDelegate.h
-[AgoraRtcMediaPlayerProtocol-p getPublishSignalVolume]
int getPublishSignalVolume()
get publish signal volume
View
UIView View
Definition: AgoraRtcMediaPlayerProtocol.h:13
-[AgoraRtcMediaPlayerProtocol-p stop]
int stop()
AgoraObjects.h
-[AgoraRtcMediaPlayerProtocol-p getMediaPlayerId]
int getMediaPlayerId()
-[AgoraRtcMediaPlayerProtocol-p getStreamCount]
NSInteger getStreamCount()
AgoraMediaPlayerRenderMode
AgoraMediaPlayerRenderMode
Definition: AgoraEnumerates.h:2308
-[AgoraRtcMediaPlayerProtocol-p getPlayoutVolume]
int getPlayoutVolume()
Get the current playback volume.
-[AgoraRtcMediaPlayerProtocol-p getDuration]
NSInteger getDuration()
-[AgoraRtcMediaPlayerProtocol-p play]
int play()
AgoraRtcMediaPlayerAudioFrameDelegate-p
Definition: AgoraRtcEngineKit.h:470