![]() |
AliyunPlayer v6.21.0
Aliyun Player API Reference Manual for iOS Platforms
|
#include "AliPlayer.h"
Instance Methods | |
(void) | - addExtSubtitle: |
Add external subtitles. | |
(void) | - clearScreen |
Clear screen. | |
(void) | - clearScreenSync |
Clear screen sync. | |
(void) | - destroy |
Sync delete the player. | |
(void) | - destroyAsync |
Async delete the player. | |
(void) | - enableDowngrade:config: |
Modify player configuration. | |
(NSString *) | - getCacheFilePath: |
Query the name of the cached file with the specified URL. | |
(NSString *) | - getCacheFilePath:format:definition: |
Query the name of the cached file with the specified URL. | |
(NSString *) | - getCacheFilePath:format:definition:previewTime: |
Query the name of the cached file with the specified URL. | |
(AVPConfig *) | - getConfig |
Query player configuration. | |
(AVPTrackInfo *) | - getCurrentTrack: |
Query the track that is being played. | |
(AVPMediaInfo *) | - getMediaInfo |
Query media information, including track information. | |
(NSString *) | - getOption: |
Get player information. | |
(int64_t) | - getPlayedDuration |
@breif get played time, will not affected by seek | |
(void *) | - getPlayer |
(NSString *) | - getPlayerName |
Get used player name. | |
(NSString *) | - getPropertyString: |
Get information by key. | |
(AVPMediaInfo *) | - getSubMediaInfo |
Query media sub stream information, including track information. | |
(void) | - getThumbnail: |
Retrieve the thumbnail image at the specified position. | |
(NSString *) | - getUserData |
Get user data, and each player instance bind one. | |
(instancetype) | - init |
Initialize the player. | |
(instancetype) | - init: |
Initialize the player. | |
(int) | - invokeComponent: |
Send command to component. | |
(void) | - pause |
Pause. | |
(void) | - prepare |
Prepare for playback. | |
(void) | - redraw |
Refresh the view in certain situations, for example, when the size of the view changes. | |
(void) | - reload |
Reload resources. | |
(void) | - reset |
Reset. | |
(void) | - seekToTime:seekMode: |
Seek to a specified position. | |
(void) | - selectExtSubtitle:enable: |
Select external subtitles. | |
(void) | - selectTrack: |
Switch definition according to the specified track index. | |
(void) | - selectTrack:accurate: |
Switch definition according to the specified track index. | |
(void) | - sendCustomEvent: |
Send custom event, will callback through AVPEventReportParamsDelegate. | |
(void) | - setAuthSource: |
Play by VID and playauth. | |
(void) | - setBitStreamSource: |
Play by bit stream. | |
(BOOL) | - setCacheConfig: |
Modify cache configuration. | |
(void) | - setConfig: |
Modify player configuration. | |
(void) | - setDefaultBandWidth: |
Set the default playback bitrate for multi-bit rate. | |
(void) | - setEventReportParamsDelegate: |
Set a proxy. | |
(void) | - setFilterConfig: |
Set filter config. | |
(void) | - setFilterInvalid:invalid: |
disable/enable filter. | |
(void) | - setLiveStsSource: |
Play by 使用LiveSts. | |
(void) | - setMaxAccurateSeekDelta: |
set the maximum interval of precision seek. | |
(void) | - setMpsSource: |
Play by VID and MPS. | |
(void) | - setOption:value: |
Set specified option. | |
(void) | - setOption:valueInt: |
Set specified option. | |
(void) | - setPictureinPictureDelegate: |
set delegate for picture in picture | |
(void) | - setPictureInPictureEnable: |
Set picture in picture enable (The picture in picture function of the player requires systems above ios15. | |
(void) | - setPictureInPictureShowMode: |
set show mode for picture in picture | |
(void) | - setPlayUrlConvertCallback: |
Set a URL conversion callback. | |
(void) | - setPreferPlayerName: |
Set preper player name. | |
(void) | - setStartTime:seekMode: |
Set a specified position as play start.Call this API before prepare, only take effect once. | |
(void) | - setStreamDelayTime:time: |
set the delay time of the stream | |
(void) | - setStsSource: |
Play by VID and STS. | |
(void) | - setThumbnailUrl: |
Specify a thumbnail image URL. | |
(void) | - setTraceID: |
Set a trace ID for debugging. | |
(void) | - setUrlSource: |
Play by URL. | |
(void) | - setUserData: |
Set user data, and will be passed to some global API, so that client can know from which player instance. | |
(void) | - setVerifyStsCallback: |
Set the AVPStsInfo expiration callback. | |
(void) | - setVideoTag:size: |
Set the video tags. | |
(void) | - snapShot |
Snapshot. | |
(void) | - start |
Start playing. | |
(void) | - stop |
Stop. | |
(void) | - switchStream: |
Multi definition stream switch by url. | |
(void) | - updateFilterConfig:options: |
upadate filter config. | |
(void) | - updateLiveStsInfo:accKey:token:region: |
update liveSts info. | |
Class Methods | |
(NSString *) | + getDeviceUUID |
Query device UUID. | |
(NSString *) | + getSDKVersion |
Query the SDK version. | |
(void) | + initPlayerComponent:function: |
Initialize player components. | |
(BOOL) | + isFeatureSupport: |
judge whether support the type of feature. | |
(void) | + netWorkReConnect |
reconnect all connections, call this when netWork router changed, and the player will use new router. | |
(void) | + setAudioSessionDelegate: |
Set AudioSession Delegate. | |
(void) | + setEnableLog: |
Enable or disable logging. | |
(void) | + setLogCallbackInfo:callbackBlock: |
Set a log output callback block. | |
(void) | + setLogOption:value: |
Set log option. | |
Properties | |
id< CicadaRenderDelegate > renderDelegate | __deprecated |
Set the render callback. | |
AVPAlphaRenderMode | alphaRenderMode |
Set a rendering mode. | |
BOOL | autoPlay |
Enable or disable autoplay. | |
int64_t | bufferedPosition |
Query the buffered position. | |
int64_t | currentDownloadSpeed |
Query the current download speed. | |
int64_t | currentPosition |
Query the current playback position. | |
int64_t | currentUtcTime |
Query the current playback utc time. | |
id< AVPDelegate > | delegate |
Set a proxy. | |
int64_t | duration |
Query the length of the video. | |
BOOL | enableHardwareDecoder |
Enable or disable hardware decoding. | |
id< AVPEventReportParamsDelegate > | eventReportParamsDelegate |
Set the event report callback. | |
int | height |
Query the height of the video. | |
int64_t | localCacheLoadedSize |
Query the current playback cached file size. | |
BOOL | loop |
Enable or disable loop playback. | |
AVPMirrorMode | mirrorMode |
Set a mirroring mode. | |
BOOL | muted |
Mute or unmute the player. | |
AVPOutputAudioChannel | outputAudioChannel |
Set the output audio channel, if input source is stereo, support select to left or right channel and if intput source is mono, this api can't take effect. | |
AVPStatus | playerStatus |
Query the player status. | |
AVPView * | playerView |
Set a player view (playerView). | |
float | rate |
Set the playback speed. | |
id< CicadaRenderingDelegate > | renderingDelegate |
Set the render callback. | |
AVPRotateMode | rotateMode |
Set a rotate mode. | |
int | rotation |
Query the rotate angle of the video, which is retrieved from the video metadata. | |
AVPScalingMode | scalingMode |
Set a zoom mode. | |
float | volume |
Query or set the volume of the player(Not system volume). | |
int | width |
Query the width of the video. | |
- (void) addExtSubtitle: | (NSString *) | URL |
Add external subtitles.
URL | subtitle address |
- (void) clearScreen |
Clear screen.
- (void) clearScreenSync |
Clear screen sync.
- (void) destroy |
Sync delete the player.
Implemented in AliListPlayer.
- (void) destroyAsync |
Async delete the player.
When instance is not needed, skip calling stop api and call this destroyAsync api can speed up view response. Once called, don't call prepare to start new play.
Implemented in AliListPlayer.
- (void) enableDowngrade: | (AVPUrlSource *) | source | |
config: | (AVPConfig *) | config |
Modify player configuration.
source | downgrade url |
config | downgrade config. |
- (NSString *) getCacheFilePath: | (NSString *) | URL |
Query the name of the cached file with the specified URL.
If a custom rule is set, delegate onGetCacheNameByURL
.
If the delegation failed, the default logic is used to generate the file name.
URL | The URL of the cached file. |
- (NSString *) getCacheFilePath: | (NSString *) | vid | |
format: | (NSString *) | format | |
definition: | (NSString *) | definition |
Query the name of the cached file with the specified URL.
If a custom rule is set, delegate onCacheNameByVidCallback
.
If the delegation failed, the default logic is used to generate the file name.
vid | The VID of the video. |
format | The format of the video. |
definition | The definition of the video. |
- (NSString *) getCacheFilePath: | (NSString *) | vid | |
format: | (NSString *) | format | |
definition: | (NSString *) | definition | |
previewTime: | (int) | previewTime |
Query the name of the cached file with the specified URL.
If a custom rule is set, delegate onCacheNameByVidCallback
.
If the delegation failed, the default logic is used to generate the file name.
vid | The VID of the video. |
format | The format of the video. |
definition | The definition of the video. |
previewTime | The preview duration of the video. |
- (AVPTrackInfo *) getCurrentTrack: | (AVPTrackType) | type |
+ (NSString *) getDeviceUUID |
Query device UUID.
- (AVPMediaInfo *) getMediaInfo |
Query media information, including track information.
- (NSString *) getOption: | (AVPOption) | key |
Get player information.
key | The key |
- (int64_t) getPlayedDuration |
@breif get played time, will not affected by seek
- (void *) getPlayer |
- (NSString *) getPlayerName |
Get used player name.
- (NSString *) getPropertyString: | (AVPPropertyKey) | key |
Get information by key.
key | The enum of key |
+ (NSString *) getSDKVersion |
Query the SDK version.
- (AVPMediaInfo *) getSubMediaInfo |
Query media sub stream information, including track information.
- (void) getThumbnail: | (int64_t) | positionMs |
Retrieve the thumbnail image at the specified position.
positionMs | The specified position. |
- (NSString *) getUserData |
Get user data, and each player instance bind one.
- (instancetype) init |
Initialize the player.
Implemented in AliListPlayer, and AliVRPlayer.
- (instancetype) init: | (NSString *) | traceID |
Initialize the player.
traceID | A trace ID for debugging. Set as "DisableAnalytics" to disable report analytics data to server(not recommended). |
Implemented in AliListPlayer, and AliVRPlayer.
+ (void) initPlayerComponent: | (NSString *) | functionName | |
function: | (void *) | function |
Initialize player components.
These components are optional. You can remove these components by deleting the dynamic libraries and code of the components on your app.
- (int) invokeComponent: | (NSString *) | content |
Send command to component.
content | command content |
+ (BOOL) isFeatureSupport: | (SupportFeatureType) | type |
judge whether support the type of feature.
type | The type of the support feature. See SupportFeatureType. |
+ (void) netWorkReConnect |
reconnect all connections, call this when netWork router changed, and the player will use new router.
- (void) pause |
Pause.
- (void) prepare |
Prepare for playback.
Asynchronous callback.
- (void) redraw |
Refresh the view in certain situations, for example, when the size of the view changes.
- (void) reload |
Reload resources.
You can reload resources when the network connection times out.
- (void) reset |
Reset.
- (void) seekToTime: | (int64_t) | time | |
seekMode: | (AVPSeekMode) | seekMode |
Seek to a specified position.
time | The specified position that the player will seek to, Unit: millisecond. |
seekMode | Seek mode. |
- (void) selectExtSubtitle: | (int) | trackIndex | |
enable: | (BOOL) | enable |
Select external subtitles.
trackIndex | caption index |
enable | true: select, false: close |
- (void) selectTrack: | (int) | trackIndex |
Switch definition according to the specified track index.
trackIndex | Specify a definition index. SELECT_AVPTRACK_TYPE_VIDEO_AUTO: auto bitrate adjustment. |
- (void) selectTrack: | (int) | trackIndex | |
accurate: | (BOOL) | accurate |
Switch definition according to the specified track index.
trackIndex | Specify a definition index. SELECT_AVPTRACK_TYPE_VIDEO_AUTO: auto bitrate adjustment. |
accurate | Use accurate seeking to select track。 |
- (void) sendCustomEvent: | (NSString *) | args |
Send custom event, will callback through AVPEventReportParamsDelegate.
Event id e = 5001.
+ (void) setAudioSessionDelegate: | (id< CicadaAudioSessionDelegate >) | delegate |
Set AudioSession Delegate.
delegate | the Delegate |
- (void) setAuthSource: | (AVPVidAuthSource *) | source |
Play by VID and playauth.
See https://help.aliyun.com/document_detail/57294.html
source | AVPVidAuthSource type. |
- (void) setBitStreamSource: | (AVPBitStreamSource *) | source |
- (BOOL) setCacheConfig: | (AVPCacheConfig *) | cacheConfig |
Modify cache configuration.
AVPCacheConfig | Cache configuration. AVPCacheConfig . |
- (void) setConfig: | (AVPConfig *) | config |
- (void) setDefaultBandWidth: | (int) | bandWidth |
Set the default playback bitrate for multi-bit rate.
The nearest stream will be selected.
bandWidth | bit rate . |
+ (void) setEnableLog: | (BOOL) | enableLog |
Enable or disable logging.
enableLog | set as true to output log |
- (void) setEventReportParamsDelegate: | (id< AVPEventReportParamsDelegate >) | delegate |
- (void) setFilterConfig: | (AVPFilterConfig *) | filterConfig |
Set filter config.
call this before prepare. If want update filter config, call updateFilterConfig()
filterConfig |
- (void) setFilterInvalid: | (NSString *) | target | |
invalid: | (BOOL) | invalid |
disable/enable filter.
target | if empty , disable all filters. |
invalid | true: enable(default); false: disable |
- (void) setLiveStsSource: | (AVPLiveStsSource *) | source |
Play by 使用LiveSts.
source | AVPLiveStsSource type. |
+ (void) setLogCallbackInfo: | (AVPLogLevel) | logLevel | |
callbackBlock: | (void(^)(AVPLogLevel logLevel, NSString *strLog)) | block |
Set a log output callback block.
Asynchronous.
logLevel | The level of the log. |
callbackBlock | Log output callback block, which can be nil. |
+ (void) setLogOption: | (AVPLogOption) | logOption | |
value: | (int) | value |
Set log option.
logOption | option logOption |
value | option value 0 represents off, 1 represents on |
- (void) setMaxAccurateSeekDelta: | (int) | delta |
set the maximum interval of precision seek.
delta | interval in milliseconds |
- (void) setMpsSource: | (AVPVidMpsSource *) | source |
Play by VID and MPS.
See https://help.aliyun.com/document_detail/53522.html?spm=5176.doc53534.2.5.mhSfOh
source | AVPVidMpsSource type. |
- (void) setOption: | (PlayerOption) | key | |
value: | (NSString *) | value |
Set specified option.
- (void) setOption: | (PlayerOption) | key | |
valueInt: | (int) | value |
Set specified option.
- (void) setPictureinPictureDelegate: | (id< AliPlayerPictureInPictureDelegate >) | delegate |
set delegate for picture in picture
delegate | pictureInPicture delegate |
- (void) setPictureInPictureEnable: | (BOOL) | enable |
Set picture in picture enable (The picture in picture function of the player requires systems above ios15.
If other systems are available, they can be customized through the pixelbuffer returned by the player cicadarenderingdelegate)
- (void) setPictureInPictureShowMode: | (AVPPIPShowMode) | pipShowMode |
set show mode for picture in picture
delegate | pictureInPicture show mode |
- (void) setPlayUrlConvertCallback: | (PlayURLConverCallback) | callback |
Set a URL conversion callback.
URL conversion is typically used in P2P broadcasting.
callback | The function pointer of the callback. |
- (void) setPreferPlayerName: | (NSString *) | name |
Set preper player name.
name | preper player name. |
- (void) setStartTime: | (int64_t) | time | |
seekMode: | (AVPSeekMode) | seekMode |
Set a specified position as play start.Call this API before prepare, only take effect once.
time | The specified position that the player will seek to, Unit: millisecond. |
seekMode | Seek mode. |
- (void) setStreamDelayTime: | (int) | index | |
time: | (int) | time |
set the delay time of the stream
index | steam index |
time | ms |
- (void) setStsSource: | (AVPVidStsSource *) | source |
Play by VID and STS.
For STS, see https://help.aliyun.com/document_detail/28756.html?spm=a2c4g.11186623.4.4.6f554c07q7B7aS
source | AVPVidStsSource type. |
- (void) setThumbnailUrl: | (NSString *) | URL |
Specify a thumbnail image URL.
URL | The specified thumbnail image URL. |
- (void) setTraceID: | (NSString *) | traceID |
Set a trace ID for debugging.
traceID | The specified client connection trace ID. |
- (void) setUrlSource: | (AVPUrlSource *) | source |
- (void) setUserData: | (NSString *) | userData |
Set user data, and will be passed to some global API, so that client can know from which player instance.
- (void) setVerifyStsCallback: | (AVPStsStatus(^)(AVPStsInfo info)) | callback |
Set the AVPStsInfo expiration callback.
callback |
- (void) setVideoTag: | (int *) | tags | |
size: | (int) | size |
Set the video tags.
Values range from [0,99].
- (void) snapShot |
Snapshot.
AVPImage: For a Mac platform, NSImage is returned. For an iOS platform, UIImage is returned.
- (void) start |
Start playing.
Implemented in AVPLiveTimeShift.
- (void) stop |
Stop.
Implemented in AliListPlayer, and AVPLiveTimeShift.
- (void) switchStream: | (NSString *) | URL |
Multi definition stream switch by url.
You can get result from AVPDelegate onStreamSwitchedSuccess/onStreamSwitchedFail.
url | new url address Note:
|
- (void) updateFilterConfig: | (NSString *) | target | |
options: | (AVPFilterOptions *) | options |
upadate filter config.
target | |
options |
- (void) updateLiveStsInfo: | (NSString *) | accId | |
accKey: | (NSString *) | accKey | |
token: | (NSString *) | token | |
region: | (NSString *) | region |
update liveSts info.
|
readwritenonatomicweak |
Set the render callback.
Deprecated, use the renderingDelegate.
|
readwritenonatomicassign |
Set a rendering mode.
Support alpha at right, left, top and bottom. Default value is none.
|
readwritenonatomicassign |
Enable or disable autoplay.
KVO is supported.
|
readnonatomicassign |
Query the buffered position.
KVO is supported.
|
readnonatomicassign |
Query the current download speed.
KVO is supported.
|
readnonatomicassign |
Query the current playback position.
KVO is supported.
|
readnonatomicassign |
Query the current playback utc time.
KVO is supported.
|
readwritenonatomicweak |
|
readnonatomicassign |
Query the length of the video.
KVO is supported.
|
readwritenonatomicassign |
Enable or disable hardware decoding.
KVO is supported.
|
readwritenonatomicweak |
Set the event report callback.
|
readnonatomicassign |
Query the height of the video.
KVO is supported.
|
readnonatomicassign |
Query the current playback cached file size.
KVO is supported.
|
readwritenonatomicassign |
Enable or disable loop playback.
KVO is supported.
|
readwritenonatomicassign |
|
readwritenonatomicassign |
Mute or unmute the player.
KVO is supported.
|
readwritenonatomicassign |
Set the output audio channel, if input source is stereo, support select to left or right channel and if intput source is mono, this api can't take effect.
This api can take effect on both audio render and audio pcm data callback.
|
readnonatomicassign |
Query the player status.
KVO is supported.
|
readwritenonatomicstrong |
Set a player view (playerView).
AVPView: Mac platform: NSOpenGLView. iOS platform: UIView.
|
readwritenonatomicassign |
Set the playback speed.
Valid values: 0.5 to 2.0. Value 1 indicates normal speed. KVO is supported.
|
readwritenonatomicweak |
Set the render callback.
|
readwritenonatomicassign |
|
readnonatomicassign |
Query the rotate angle of the video, which is retrieved from the video metadata.
KVO is supported.
|
readwritenonatomicassign |
|
readwritenonatomicassign |
Query or set the volume of the player(Not system volume).
KVO is supported. The range is 0.0~2.0,it maybe lead to noise if set volume more then 1.0, not recommended.
|
readnonatomicassign |
Query the width of the video.
KVO is supported.