![]() |
AliyunPlayer v7.9.0
Aliyun Player API Reference Manual for iOS Platforms
|
#include "AliPlayer.h"
Instance Methods | |
| (void) | - addExtSubtitle: |
| Add external subtitle file. | |
| (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. | |
| (BOOL) | - isAutoBandWidth |
| Get the current status of adaptive selection of initial playback quality for multi-bitrate playback. | |
| (BOOL) | - isEnableSubtitleRender |
| (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 or disable the specified external subtitle track. | |
| (void) | - selectTrack: |
| Switch video quality according to the specified track index. | |
| (void) | - selectTrack:accurate: |
| Switch video quality according to the specified track index with accurate seeking option. | |
| (void) | - sendCustomEvent: |
Sends a user-defined event, which will be called back via OnReportEventListener. | |
| (void) | - setAuthSource: |
| Play by VID and playauth. | |
| (void) | - setAutoBandWidth: |
| Enable or disable adaptive selection of initial playback quality for multi-bitrate playback. | |
| (void) | - setBitStreamSource: |
| Play by bit stream. | |
| (BOOL) | - setCacheConfig: |
| Modify cache configuration. | |
| (void) | - setConfig: |
| Modify player configuration. | |
| (void) | - setDefaultBandWidth: |
| Set the default initial playback bitrate for multi-bitrate playback. | |
| (void) | - setDefaultResolution: |
| Set the default initial playback resolution for multi-bitrate playback. | |
| (void) | - setEnableSubtitleRender: |
| is open subtitle render | |
| (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) | - setPlayerScene: |
| Set player scene. | |
| (void) | - setPlayUrlConvertCallback: |
| Set a URL conversion callback. | |
| (void) | - setPreferPlayerName: |
Sets the preferred player kernel when playing, the default is the self-developed player core, can be switched to the system player, set before calling prepare. | |
| (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 for the player instance, which can be used to distinguish different player instances in multi-instance scenarios. | |
| (void) | - setVerifyStsCallback: |
| During encrypted live streaming, there might be processes to change the encryption key. | |
| (void) | - setVideoTag:size: |
| Set the video tags. | |
| (void) | - snapShot |
| Create a snapshot for the current frame. | |
| (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 LiveStsInfo. | |
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 alpha render mode, can be used on gift play on live stream, etc. | |
| 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. | |
| id< AVPDrmDelegate > | drmDelegate |
| set DRM request callback. | |
| 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 subtitle file.
Supports various subtitle formats such as SRT, ASS, VTT, etc.
| URL | Subtitle file URL address, supporting local file path or network 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 |
| - (BOOL) isAutoBandWidth |
Get the current status of adaptive selection of initial playback quality for multi-bitrate playback.
| - (BOOL) isEnableSubtitleRender |
| + (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 or disable the specified external subtitle track.
| trackIndex | Subtitle track index, get available subtitle track list through media info |
| enable | YES to select and display the subtitle track, NO to disable subtitle display |
| - (void) selectTrack: | (int) | trackIndex |
Switch video quality according to the specified track index.
Supports manual quality selection or adaptive bitrate mode.
| trackIndex | Target quality track index. Use SELECT_AVPTRACK_TYPE_VIDEO_AUTO for adaptive bitrate adjustment |
| - (void) selectTrack: | (int) | trackIndex | |
| accurate: | (BOOL) | accurate |
Switch video quality according to the specified track index with accurate seeking option.
| trackIndex | Target quality track index. Use SELECT_AVPTRACK_TYPE_VIDEO_AUTO for adaptive bitrate adjustment |
| accurate | Whether to use accurate seeking mode for switching. YES for accurate seeking, NO for fast seeking |
| - (void) sendCustomEvent: | (NSString *) | args |
Sends a user-defined event, which will be called back via OnReportEventListener.
This is used to unify business events/metrics through the player's reporting callback for consistent business flow. User-defined event code is 5001, and args is the transparently transmitted parameter.
| args | The parameter passed in for the user-defined event. |
| + (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) setAutoBandWidth: | (BOOL) | enable |
Enable or disable adaptive selection of initial playback quality for multi-bitrate playback.
Note: This interface only affects quality selection at startup and will not dynamically adjust quality after playback starts. The maximum resolution for adaptive selection can be limited by PlayerConfig.mMaxAllowedAbrVideoPixelNumber.
| enable | YES to enable adaptive initial quality selection, NO to disable |
| - (void) setBitStreamSource: | (AVPBitStreamSource *) | source |
| - (BOOL) setCacheConfig: | (AVPCacheConfig *) | cacheConfig |
Modify cache configuration.
| AVPCacheConfig | Cache configuration. AVPCacheConfig. |
AliPlayerGlobalSettings::enableLocalCache:(bool)enable instead. | - (void) setConfig: | (AVPConfig *) | config |
| - (void) setDefaultBandWidth: | (int) | bandWidth |
Set the default initial playback bitrate for multi-bitrate playback.
The player will select the stream closest to the specified bitrate.
| bandWidth | Default playback bitrate value in bps (bits per second) |
| - (void) setDefaultResolution: | (int) | resolutionProduct |
Set the default initial playback resolution for multi-bitrate playback.
Select the closest resolution stream based on the resolution product value.
| resolutionProduct | The product of width and height corresponding to the target resolution. The player will select the resolution closest to this value for initial playback. For example: passing 1920 * 1080 = 2073600, the player will select the stream closest to 1920x1080 resolution for playback |
| + (void) setEnableLog: | (BOOL) | enableLog |
Enable or disable logging.
| enableLog | set as true to output log |
| - (void) setEnableSubtitleRender: | (BOOL) | enable |
is open subtitle render
| enable | true: open, false: close |
| - (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.
| source | AVPVidMpsSource type. |
setAuthSource instead. | - (void) setOption: | (PlayerOption) | key | |
| value: | (NSString *) | value |
Set specified option.
| - (void) setOption: | (PlayerOption) | key | |
| valueInt: | (int) | value |
Set specified option.
Implemented in AliListPlayer.
| - (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) setPlayerScene: | (AVPScene) | scene |
| - (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 |
Sets the preferred player kernel when playing, the default is the self-developed player core, can be switched to the system player, set before calling prepare.
| name | Player name, such as "AppleAVPlayer", which is iOS system player, the default value is "". |
| - (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 |
| - (void) setStsSource: | (AVPVidStsSource *) | source |
Play by VID and STS.
For STS, see https://help.aliyun.com/document_detail/28756.html
| 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 for the player instance, which can be used to distinguish different player instances in multi-instance scenarios.
Can get the user data through AliPlayer::getUserData .
| userData | user-defined data |
| - (void) setVerifyStsCallback: | (AVPStsStatus(^)(AVPStsInfo info)) | callback |
During encrypted live streaming, there might be processes to change the encryption key.
When changing keys, the latest key will be requested via STS. Developers need to monitor whether the STS is valid. If it's invalid, it will affect the playback of the encrypted live stream. Once new STS got, need to call updateLiveStsInfo to update.
| callback |
| - (void) setVideoTag: | (int *) | tags | |
| size: | (int) | size |
| - (void) snapShot |
Create a snapshot for the current frame.
You can call AVPDelegate::onCaptureScreen to fetch the snapshot image.
| - (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 LiveStsInfo.
| accId | the AccessKey ID for authentication. |
| accKey | the AccessKey Secret for authentication. |
| token | securityToken The specified token. |
| region | The specified regions. |
|
readwritenonatomicweak |
Set the render callback.
Deprecated, use the renderingDelegate.
|
readwritenonatomicassign |
Set alpha render mode, can be used on gift play on live stream, etc.
Detail usage: doc
|
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 |
|
readwritenonatomicweak |
set DRM request callback.
This callback will be triggered only when play with setUrlSource, not VidAuth and VidSts play. Support Fairplay only.
|
readnonatomicassign |
Query the length of the video.
KVO is supported.
|
readwritenonatomicassign |
Enable or disable hardware decoding.
Default is enable. If hardware decoding fails, it will fall back to software decoding. If adaptive fallback is configured using AliPlayerGlobalSettings::setAdaptiveDecoderGetBackupURLCallback, the player can switch to play videos with different encodings, such as H265 to H264.
|
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.