AliyunPlayer v7.10.0
Aliyun Player API Reference Manual for iOS Platforms
Loading...
Searching...
No Matches
AliPlayer Class Reference

#include "AliPlayer.h"

Inheritance diagram for AliPlayer:
AVPLiveTimeShift AliListPlayer AliVRPlayer

Instance Methods

(void) - addExtSubtitle:
 Add external subtitle file.
(void) - clearScreen
 Clear screen.
(void) - clearScreenSync
 Clear screen sync, suggest using clearScreen.
(void) - destroy
 Destroy the player (synchronous).
(void) - destroyAsync
 Async delete the player.
(void) - enableDowngrade:config:
 Set player downgrade configuration, applicable to RTS custom downgrade url settings, for details please refer to RTS自定义降级url设置.
(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.
(NSString *) - getOption:
 Get player option parameter.
(int64_t) - getPlayedDuration
 Get the actual played duration.
(void *) - getPlayer
(NSString *) - getPlayerName
 Get used player name.
(NSString *) - getPropertyString:
 Get player property information.
(AVPMediaInfo *) - getSubMediaInfo
 Query sub-stream media information.
(void) - getThumbnail:
 Retrieve the thumbnail image at the specified position.
(NSString *) - getUserData
 Get user data of the player instance.
(instancetype) - init
 Initialize the player.
(instancetype) - init:
 Initialize the player with a trace ID.
(int) - invokeComponent:
 Send command to component.
(BOOL) - isAutoBandWidth
 Query the status of adaptive initial quality selection for multi-bitrate playback.
(BOOL) - isEnableSubtitleRender
 Query whether subtitle rendering is enabled.
(void) - pause
 Pause playback.
(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 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:
 Send custom analytics event.
(void) - setAuthSource:
 Play by VID and playauth.
(void) - setAutoBandWidth:
 Enable or disable adaptive initial playback quality selection 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:
 Enable or disable subtitle rendering.
(void) - setEventReportParamsDelegate:
 Set event report delegate.
(void) - setFilterConfig:
 Set filter configuration.
(void) - setFilterInvalid:invalid:
 Enable or disable filter.
(void) - setLiveStsSource:
 Play by LiveSts.
(void) - setMaxAccurateSeekDelta:
 Set the maximum interval for accurate seeking.
(void) - setMpsSource:
 Play by VID and MPS.
(void) - setOnURLSourceExpiredCallback:
 Set the callback for URL source expiration notification.
(void) - setOnVidAuthExpiredCallback:
 Set the callback for VidAuth source expiration notification.
(void) - setOption:value:
 Set player specific option (string value).
(void) - setOption:valueInt:
 Set player specific option (integer value).
(void) - setPictureinPictureDelegate:
 Set delegate for picture-in-picture functionality.
(void) - setPictureInPictureEnable:
 Enable or disable picture-in-picture functionality.
(void) - setPictureInPictureShowMode:
 Set display mode for picture-in-picture functionality.
(void) - setPlayerScene:
 Set player scene.
(void) - setPlayUrlConvertCallback:
 Set a URL conversion callback.
(void) - setPreferPlayerName:
 Set preferred player kernel.
(void) - setStartTime:seekMode:
 Set the initial playback position.
(void) - setStreamDelayTime:time:
 set the delay time of the stream, default is 0 only support external subtitles
(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.
(void) - setVerifyStsCallback:
 Set STS validity verification callback for encrypted live streaming.
(void) - setVideoTag:size:
 Set the video tags.
(void) - snapShot
 Capture the current frame.
(void) - start
 Start playing.
(void) - stop
 Stop playback.
(void) - switchStream:
 Multi definition stream switch by url.
(void) - updateFilterConfig:options:
 Update filter configuration.
(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 component.
(BOOL) + isFeatureSupport:
 Query feature support.
(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
 Buffered position.
int64_t currentDownloadSpeed
 Current network download speed.
int64_t currentPosition
 Current playback position.
int64_t currentUtcTime
 Query the current playback utc time.
id< AVPDelegatedelegate
 Player delegate.
id< AVPDrmDelegatedrmDelegate
 DRM delegate.
int64_t duration
 Playback duration.
BOOL enableHardwareDecoder
 Hardware decoding enabled state.
id< AVPEventReportParamsDelegateeventReportParamsDelegate
 Set the event report callback.
int height
 Query the height of the video.
int64_t localCacheLoadedSize
 Local cache hit 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
 Player status.
AVPView * playerView
 Set a player view (playerView).
float rate
 Set the playback speed.
id< CicadaRenderingDelegate > renderingDelegate
 Video rendering delegate (new).
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.

Method Documentation

◆ addExtSubtitle:

- (void) addExtSubtitle: (NSString *) URL

Add external subtitle file.

Adds an external subtitle file for the player to use. Supports various subtitle formats including SRT, ASS, VTT, etc. After adding, you can select and display it via selectExtSubtitle. For external subtitle usage, refer to External Subtitles

Parameters
URLSubtitle file URL address supporting local file path (file://) or network address (http://, https://)
See also
selectExtSubtitle
AVPDelegate::onSubtitleExtAdded

◆ clearScreen

- (void) clearScreen

Clear screen.

◆ clearScreenSync

- (void) clearScreenSync

Clear screen sync, suggest using clearScreen.

◆ destroy

- (void) destroy

Destroy the player (synchronous).

Synchronously releases all resources occupied by the player. After calling this method, the player instance is no longer usable. Recommended to call when playback is no longer needed.

Implemented in AliListPlayer.

◆ destroyAsync

- (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.

◆ enableDowngrade:config:

- (void) enableDowngrade: (AVPUrlSource *) source
config: (AVPConfig *) config 

Set player downgrade configuration, applicable to RTS custom downgrade url settings, for details please refer to RTS自定义降级url设置.

Parameters
sourcedowngrade url
configdowngrade config.
See also
AVPConfig

◆ getCacheFilePath:

- (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.

Parameters
URLThe URL of the cached file.
Returns
The name of the cached file. The file extension is not included. All files use the .alv extension.
Deprecated
From version 7.0.0, This method is deprecated.

◆ getCacheFilePath:format:definition:

- (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.

Parameters
vidThe VID of the video.
formatThe format of the video.
definitionThe definition of the video.
Returns
The name of the cached file. The file extension is not included. All files use the .alv extension.
Deprecated
From version 7.0.0, This method is deprecated.

◆ getCacheFilePath:format:definition:previewTime:

- (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.

Parameters
vidThe VID of the video.
formatThe format of the video.
definitionThe definition of the video.
previewTimeThe preview duration of the video.
Returns
The name of the cached file. The file extension is not included. All files use the .alv extension.

◆ getConfig

- (AVPConfig *) getConfig

Query player configuration.

Retrieves all current configuration parameters of the player. Can be used to get current values before selectively modifying them.

Returns
AVPConfig instance containing all current configuration parameters
See also
AVPConfig
setConfig

◆ getCurrentTrack:

- (AVPTrackInfo *) getCurrentTrack: (AVPTrackType) type

Query the track that is being played.

Parameters
typeTrack type.
See also
AVPTrackType

◆ getDeviceUUID

+ (NSString *) getDeviceUUID

Query device UUID.

Gets the unique identifier of the current device. Can be used for device tracking and log analysis.

Returns
Device UUID string

◆ getMediaInfo

- (AVPMediaInfo *) getMediaInfo

Query media information.

Retrieves detailed information about the current playback media, including all track information for video, audio, subtitles, etc. This method should only be called after receiving AVPEventType::AVPEventPrepareDone event.

Returns
AVPMediaInfo instance containing complete media information; returns nil if not yet loaded
See also
AVPMediaInfo
AVPTrackInfo
AVPEventType::AVPEventPrepareDone

◆ getOption:

- (NSString *) getOption: (AVPOption) key

Get player option parameter.

Queries real-time performance metrics of the player, such as current rendering frame rate, network bitrate, video bitrate, etc.

Parameters
keyOption key specifying the type of parameter to query
Returns
String representation of parameter value; specific meaning depends on parameter type (usually numeric)
See also
AVPOption

◆ getPlayedDuration

- (int64_t) getPlayedDuration

Get the actual played duration.

Retrieves the actual playback duration, not affected by seek operations. This duration does not include non-playback time such as pauses and buffering.

Use setOption:valueInt: with PLAYED_DURATION_INCLUDE_SPEED option to control whether playback duration considers playback speed effects.

Returns
Played duration. Unit: microseconds.
See also
- setOption:valueInt:
PLAYED_DURATION_INCLUDE_SPEED

◆ getPlayer

- (void *) getPlayer

◆ getPlayerName

- (NSString *) getPlayerName

Get used player name.

◆ getPropertyString:

- (NSString *) getPropertyString: (AVPPropertyKey) key

Get player property information.

Retrieves player property information based on the specified property key, such as HTTP response information, connection information, etc. These properties are typically used for debugging, performance analysis, and diagnostics.

Parameters
keyProperty key specifying the type of property to query
Returns
Property information string; returns empty string if property does not exist or is not loaded
See also
AVPPropertyKey

◆ getSDKVersion

+ (NSString *) getSDKVersion

Query the SDK version.

Returns
SDK version string

◆ getSubMediaInfo

- (AVPMediaInfo *) getSubMediaInfo

Query sub-stream media information.

Retrieves media information of sub-streams (sub-m3u8) in multi-bitrate HLS streams.

Returns
AVPMediaInfo instance containing current sub-stream media information
See also
AVPMediaInfo
AVPTrackInfo
AVPEventType::AVPEventPrepareDone

◆ getThumbnail:

- (void) getThumbnail: (int64_t) positionMs

Retrieve the thumbnail image at the specified position.

Asynchronously retrieves the thumbnail image at the specified playback position. The result is returned via AVPDelegate::onGetThumbnailSuc and AVPDelegate::onGetThumbnailFailed callbacks.

setThumbnailUrl must be called before invoking this method.

Parameters
positionMsSpecified position in milliseconds
See also
AVPDelegate::onGetThumbnailSuc
AVPDelegate::onGetThumbnailFailed
setThumbnailUrl

◆ getUserData

- (NSString *) getUserData

Get user data of the player instance.

Retrieves user data previously set via setUserData. Each player instance can bind one user data.

Returns
User data string; returns nil or empty string if not set
See also
setUserData

◆ init

- (instancetype) init

Initialize the player.

Creates a player instance. The player must be initialized through this method before any subsequent playback operations.

Implemented in AliListPlayer, and AliVRPlayer.

◆ init:

- (instancetype) init: (NSString *) traceID

Initialize the player with a trace ID.

Parameters
traceIDA trace ID for debugging. Set as "DisableAnalytics" to disable report analytics data to server(not recommended). We recommend using the Player Single Point Trace function to trace the playback behavior of a specific user or playback session. The traceId value is defined by you, which must be a unique identifier for your user or device. For example, you can pass in your user's userid or IMEI, IDFA, etc.

Implemented in AliListPlayer, and AliVRPlayer.

◆ initPlayerComponent:function:

+ (void) initPlayerComponent: (NSString *) functionName
function: (void *) function 

Initialize player component.

Initializes optional player components. These components are optional; you can remove dynamic libraries and initialization code to trim unused functionality.

Parameters
functionNameComponent feature name
functionComponent initialization function pointer

◆ invokeComponent:

- (int) invokeComponent: (NSString *) content

Send command to component.

Parameters
contentcommand content
Returns
< 0 on Error
Deprecated

◆ isAutoBandWidth

- (BOOL) isAutoBandWidth

Query the status of adaptive initial quality selection for multi-bitrate playback.

Returns
YES if adaptive initial quality selection is enabled, NO if disabled
See also
setAutoBandWidth

◆ isEnableSubtitleRender

- (BOOL) isEnableSubtitleRender

Query whether subtitle rendering is enabled.

Returns
YES if subtitle rendering is enabled, NO if disabled
See also
setEnableSubtitleRender

◆ isFeatureSupport:

+ (BOOL) isFeatureSupport: (SupportFeatureType) type

Query feature support.

Checks whether the current device supports the specified feature, such as Dolby Audio.

Parameters
typeFeature type
Returns
YES if feature is supported, NO if not
See also
SupportFeatureType

◆ netWorkReConnect

+ (void) netWorkReConnect

reconnect all connections, call this when netWork router changed, and the player will use new router.

◆ pause

- (void) pause

Pause playback.

Pauses the current playback. Status changes are notified via AVPDelegate::onPlayerStatusChanged. If the player is already paused or stopped, this call has no effect. To resume playback, call start.

See also
AVPDelegate::onPlayerStatusChanged
AVPStatus

◆ prepare

- (void) prepare

Prepare for playback.

Asynchronous callback. Initializes media resources, establishes network connections, and loads media information. Completion is notified via AVPEventType::AVPEventPrepareDone event or AVPDelegate::onPlayerStatusChanged callback. The time to prepare to prepare complete is related to AVPConfig::startBufferDuration.

See also
AVPEventType::AVPEventPrepareDone
AVPDelegate::onPlayerStatusChanged
AVPConfig::startBufferDuration

◆ redraw

- (void) redraw

Refresh the view in certain situations, for example, when the size of the view changes.

Deprecated
Deprecated

◆ reload

- (void) reload

Reload resources.

You can reload resources when the network connection times out.

◆ reset

- (void) reset

Reset.

Deprecated
Deprecated

◆ seekToTime:seekMode:

- (void) seekToTime: (int64_t) time
seekMode: (AVPSeekMode) seekMode 

Seek to a specified position.

Parameters
timeThe specified position that the player will seek to, Unit: millisecond.
seekModeSeek mode.
See also
AVPSeekMode

◆ selectExtSubtitle:enable:

- (void) selectExtSubtitle: (int) trackIndex
enable: (BOOL) enable 

Select or disable external subtitle track.

Selects a specific external subtitle track for display, or disables subtitle display. Track index is obtained via AVPMediaInfo.

Parameters
trackIndexSubtitle track index obtained via getMediaInfo for available subtitle tracks
enableYES to select and display the subtitle track, NO to disable subtitle display
See also
- selectExtSubtitle:enable:
AVPMediaInfo
AVPTrackInfo

◆ selectTrack:

- (void) selectTrack: (int) trackIndex

Switch video quality according to the specified track index.

Supports manual quality selection or adaptive bitrate mode.

Parameters
trackIndexTarget quality track index. Use SELECT_AVPTRACK_TYPE_VIDEO_AUTO for adaptive bitrate adjustment

◆ selectTrack:accurate:

- (void) selectTrack: (int) trackIndex
accurate: (BOOL) accurate 

Switch video quality according to the specified track index with accurate seeking option.

Parameters
trackIndexTarget quality track index. Use SELECT_AVPTRACK_TYPE_VIDEO_AUTO for adaptive bitrate adjustment
accurateWhether to use accurate seeking mode for switching. YES for accurate seeking, NO for fast seeking

◆ sendCustomEvent:

- (void) sendCustomEvent: (NSString *) args

Send custom analytics event.

Sends a custom event to the player's analytics system, which will be passed to the application via AVPEventReportParamsDelegate callback. Used to unify business events through the player's analytics callback for centralized data collection and processing.

Custom event code is 5001; args parameter contains custom event data passed through transparently.

Parameters
argsCustom event parameter data; can be any string
See also
AVPEventReportParamsDelegate

◆ setAudioSessionDelegate:

+ (void) setAudioSessionDelegate: (id< CicadaAudioSessionDelegate >) delegate

Set AudioSession delegate.

Sets a custom delegate for iOS AVAudioSession to handle audio session events and configuration.

Parameters
delegateAudioSession delegate object

◆ setAuthSource:

- (void) setAuthSource: (AVPVidAuthSource *) source

Play by VID and playauth.

See https://help.aliyun.com/document_detail/57294.html Plays video after authentication through Alibaba Cloud Video ID and playback authorization token. This is the recommended authentication method by Alibaba Cloud for most scenarios.

Parameters
sourceAVPVidAuthSource type.
See also
AVPVidAuthSource

◆ setAutoBandWidth:

- (void) setAutoBandWidth: (BOOL) enable

Enable or disable adaptive initial playback quality selection for multi-bitrate playback.

Enables or disables automatic initial resolution selection in adaptive bitrate (ABR) mode. When enabled, the player automatically selects an appropriate resolution based on network conditions without manual specification.

Note
This feature only affects resolution selection at startup and does not dynamically adjust after playback starts
Maximum resolution for adaptive selection can be limited via AVPConfig::maxAllowedAbrVideoPixelNumber
Parameters
enableYES to enable adaptive initial quality selection, NO to disable (use default quality)
See also
- isAutoBandWidth
setDefaultResolution
AVPConfig::maxAllowedAbrVideoPixelNumber

◆ setBitStreamSource:

- (void) setBitStreamSource: (AVPBitStreamSource *) source

Play by bit stream.

Parameters
sourceAVPBitStreamSource type.
See also
AVPBitStreamSource

◆ setCacheConfig:

- (BOOL) setCacheConfig: (AVPCacheConfig *) cacheConfig

Modify cache configuration.

Parameters
AVPCacheConfigCache configuration. AVPCacheConfig.
Returns
If the cache configuration is modified, YES is returned.
Deprecated
From version 7.0.0, this interface is deprecated. Please use + enableLocalCache: (AliPlayerGlobalSettings) instead.

◆ setConfig:

- (void) setConfig: (AVPConfig *) config

Modify player configuration.

Modifies various player configuration parameters such as buffer duration, autoplay, loop playback, etc. Recommended to configure before calling prepare.

Parameters
configAVPConfig instance containing all configurable player parameters
See also
AVPConfig
- getConfig

◆ setDefaultBandWidth:

- (void) setDefaultBandWidth: (int) bandWidth

Set the default initial playback bitrate for multi-bitrate playback.

For multi-bitrate stream playback, the player selects the stream closest to the specified bitrate. If adaptive bitrate mode is enabled, this setting may be ignored.

Parameters
bandWidthDefault initial playback bitrate in bps (bits per second)
See also
setDefaultResolution
setAutoBandWidth

◆ setDefaultResolution:

- (void) setDefaultResolution: (int) resolutionProduct

Set the default initial playback resolution for multi-bitrate playback.

Specifies the default initial resolution through the product of resolution width and height. The player selects the resolution closest to this value. For example, 1920×1080 resolution has a product of 2,073,600.

Parameters
resolutionProductProduct of target resolution width and height. Player selects closest resolution
See also
setDefaultBandWidth
setAutoBandWidth
AVPPixelNumber

◆ setEnableLog:

+ (void) setEnableLog: (BOOL) enableLog

Enable or disable logging.

Globally controls whether the player outputs debug logs. When enabled, log information can be obtained via callbacks or system logs.

Parameters
enableLogYES to enable logging, NO to disable logging
See also
setLogCallbackInfo

◆ setEnableSubtitleRender:

- (void) setEnableSubtitleRender: (BOOL) enable

Enable or disable subtitle rendering.

Parameters
enabletrue: enable, false: disable

◆ setEventReportParamsDelegate:

- (void) setEventReportParamsDelegate: (id< AVPEventReportParamsDelegate >) delegate

Set event report delegate.

Sets the delegate object for event reporting parameters to receive player analytics data. This allows unified business event tracking through the player's callback.

Parameters
delegateEvent report parameter delegate object
See also
AVPEventReportParamsDelegate

◆ setFilterConfig:

- (void) setFilterConfig: (AVPFilterConfig *) filterConfig

Set filter configuration.

Configures video filter effects for the player. Filter configuration should be set before calling prepare. To dynamically update filters, use updateFilterConfig. Filters are effective only when enabled; they can be temporarily disabled via setFilterInvalid.

Parameters
filterConfigFilter configuration object
See also
AVPFilterConfig
updateFilterConfig
setFilterInvalid

◆ setFilterInvalid:invalid:

- (void) setFilterInvalid: (NSString *) target
invalid: (BOOL) invalid 

Enable or disable filter.

Controls the enable/disable state of a specified filter. After disabling, parameters are retained and the previous configuration is restored when re-enabled.

Parameters
targetFilter target name. If empty string or nil, the operation affects all configured filters
invalidYES to disable the filter (invalid state), NO to enable the filter (valid state)
Note
Parameter name is "invalid" meaning "whether to make filter invalid"; note the inverted logic
See also
setFilterConfig
updateFilterConfig

◆ setLiveStsSource:

- (void) setLiveStsSource: (AVPLiveStsSource *) source

Play by LiveSts.

Plays encrypted live stream after authentication through temporary security token. Suitable for live streaming scenarios requiring access control and encryption.

Parameters
sourceAVPLiveStsSource type.

◆ setLogCallbackInfo:callbackBlock:

+ (void) setLogCallbackInfo: (AVPLogLevel) logLevel
callbackBlock: (void(^)(AVPLogLevel logLevel, NSString *strLog)) block 

Set a log output callback block.

Asynchronous.

Parameters
logLevelThe level of the log.
callbackBlockLog output callback block, which can be nil.
See also
AVPLogLevel

◆ setLogOption:value:

+ (void) setLogOption: (AVPLogOption) logOption
value: (int) value 

Set log option.

Configures specific features of the logging system, such as enabling frame-level logging.

Parameters
logOptionLog option type
valueOption value. 0 to disable, 1 to enable
See also
AVPLogOption

◆ setMaxAccurateSeekDelta:

- (void) setMaxAccurateSeekDelta: (int) delta

Set the maximum interval for accurate seeking.

When the distance between the accurate seek position and the previous keyframe exceeds this interval, the player no longer supports accurate seeking and switches to fast seek mode. This avoids long processing times for seeking far distances.

Parameters
deltaInterval duration in milliseconds. Accurate seeks exceeding this distance will degrade to fast seek.

◆ setMpsSource:

- (void) setMpsSource: (AVPVidMpsSource *) source

Play by VID and MPS.

Parameters
sourceAVPVidMpsSource type.
See also
AVPVidMpsSource
Deprecated
Please use setAuthSource instead.

◆ setOnURLSourceExpiredCallback:

- (void) setOnURLSourceExpiredCallback: (void(^)(id expiredSource, id< AVPSourceRefreshCallback > callback)) callback

Set the callback for URL source expiration notification.

This method is triggered when the player detects that the current URL source has expired. You can refresh the URL source within the callback and use the callback to return the updated URL source, ensuring uninterrupted video playback.

Parameters
callbackThe callback block triggered when the URL source expires. Use this callback to provide a valid URLSource object to update the player.

◆ setOnVidAuthExpiredCallback:

- (void) setOnVidAuthExpiredCallback: (void(^)(id expiredSource, id< AVPSourceRefreshCallback > callback)) callback

Set the callback for VidAuth source expiration notification.

This method is triggered when the player detects that the current VidAuth source has expired. You can refresh the VidAuth source within the callback and use the callback to return the updated VidAuth source, ensuring uninterrupted and smooth video playback.

Parameters
callbackThe callback block triggered when the VidAuth source expires. Use this callback to provide a valid VidAuth object to update the player.

◆ setOption:value:

- (void) setOption: (PlayerOption) key
value: (NSString *) value 

Set player specific option (string value).

Sets option parameters for specific player features. Some options accept string-type values.

Parameters
keyOption key specifying the type of option to set
valueString representation of the option value
See also
PlayerOption

◆ setOption:valueInt:

- (void) setOption: (PlayerOption) key
valueInt: (int) value 

Set player specific option (integer value).

Sets option parameters for specific player features. Some options accept integer-type values.

Parameters
keyOption key specifying the type of option to set
valueInteger representation of the option value
See also
PlayerOption

Implemented in AliListPlayer.

◆ setPictureinPictureDelegate:

- (void) setPictureinPictureDelegate: (id< AliPlayerPictureInPictureDelegate >) delegate

Set delegate for picture-in-picture functionality.

Sets the delegate object for Picture-in-Picture (PIP) functionality to handle PIP-related events and state changes.

Parameters
delegateDelegate object for picture-in-picture functionality

◆ setPictureInPictureEnable:

- (void) setPictureInPictureEnable: (BOOL) enable

Enable or disable picture-in-picture functionality.

Globally controls whether iOS system picture-in-picture functionality is enabled. This feature requires iOS 15 or later. For systems below iOS 15, you can implement custom picture-in-picture by obtaining pixel buffer data via CicadaRenderingDelegate.

Parameters
enableYES to enable picture-in-picture, NO to disable
See also
setPictureinPictureDelegate
CicadaRenderingDelegate

◆ setPictureInPictureShowMode:

- (void) setPictureInPictureShowMode: (AVPPIPShowMode) pipShowMode

Set display mode for picture-in-picture functionality.

Specifies how control UI is displayed in picture-in-picture mode. Can choose to show all buttons or hide specific ones.

Parameters
pipShowModePicture-in-picture display mode. Default is AVP_SHOW_MODE_DEFAULT
See also
AVPPIPShowMode

◆ setPlayerScene:

- (void) setPlayerScene: (AVPScene) scene

Set player scene.

Specifies a playback scenario (long video, short video, live streaming, etc.) for the player. The player automatically applies optimal configurations for the scenario without manual parameter adjustment.

Parameters
scenePlayer scene type
See also
AVPScene

◆ setPlayUrlConvertCallback:

- (void) setPlayUrlConvertCallback: (PlayURLConverCallback) callback

Set a URL conversion callback.

URL conversion is typically used in P2P broadcasting.

Parameters
callbackThe function pointer of the callback.

◆ setPreferPlayerName:

- (void) setPreferPlayerName: (NSString *) name

Set preferred player kernel.

Specifies the player kernel type, can choose between self-developed kernel or system kernel. This setting must be made before calling prepare to take effect.

Parameters
namePlayer kernel name. Default is empty string (use self-developed kernel). "AppleAVPlayer" to use iOS system player
See also
- prepare

◆ setStartTime:seekMode:

- (void) setStartTime: (int64_t) time
seekMode: (AVPSeekMode) seekMode 

Set the initial playback position.

Specifies the position where playback begins. This method is only effective when called before prepare, and takes effect only once per preparation. Replaces the traditional pre-playback seek approach.

Parameters
timeInitial playback position in milliseconds
seekModeSeek mode specifying accurate or fast positioning
See also
AVPSeekMode

◆ setStreamDelayTime:time:

- (void) setStreamDelayTime: (int) index
time: (int) time 

set the delay time of the stream, default is 0 only support external subtitles

Parameters
indexsteam index
timems
Deprecated

◆ setStsSource:

- (void) setStsSource: (AVPVidStsSource *) source

Play by VID and STS.

For STS, see https://help.aliyun.com/document_detail/28756.html Plays video after authentication and authorization through Alibaba Cloud Video ID and temporary security token. Suitable for scenarios requiring access control.

Parameters
sourceAVPVidStsSource type.
See also
AVPVidStsSource

◆ setThumbnailUrl:

- (void) setThumbnailUrl: (NSString *) URL

Specify a thumbnail image URL.

Sets the URL address of the thumbnail image. Must be called before getThumbnail. Thumbnails can be generated through Alibaba Cloud console configuration.

Parameters
URLURL address of the thumbnail service
See also
getThumbnail

◆ setTraceID:

- (void) setTraceID: (NSString *) traceID

Set a trace ID for debugging.

Sets a unique identifier for log tracing and diagnostics for the player instance. Recommended to use Player Single Point Trace for diagnostics and performance analysis. The traceID should be a unique identifier for user or device, such as userid, IMEI, or IDFA.

Parameters
traceIDUnique identifier for log tracing

◆ setUrlSource:

- (void) setUrlSource: (AVPUrlSource *) source

Play by URL.

Sets the playback source as a URL address. Supports live and VOD streams with HTTP, HTTPS protocols.

Parameters
sourceAVPUrlSource type.
See also
AVPUrlSource

◆ setUserData:

- (void) setUserData: (NSString *) userData

Set user data for the player instance.

Binds custom user data to this player instance. In multi-instance scenarios, can be used to differentiate different player instances. User data can be retrieved via getUserData.

Parameters
userDataCustom user data string; can be any business-related data such as user ID, video ID, etc.
See also
- getUserData

◆ setVerifyStsCallback:

- (void) setVerifyStsCallback: (AVPStsStatus(^)(AVPStsInfo info)) callback

Set STS validity verification callback for encrypted live streaming.

During encrypted live streaming playback, when encryption key needs to be updated, the player verifies whether the current STS credentials are valid through this callback. Developers must listen to this callback and return the STS status. If STS is invalid, update with latest credentials via updateLiveStsInfo.

Parameters
callbackSTS validity check callback. Callback parameter is current STS information, return value is STS status
See also
updateLiveStsInfo
AVPStsInfo
AVPStsStatus

◆ setVideoTag:size:

- (void) setVideoTag: (int *) tags
size: (int) size 

Set the video tags.

Values range from [0,99].

Deprecated

◆ snapShot

- (void) snapShot

Capture the current frame.

Asynchronously captures the image of the current playback frame. The screenshot result is returned via AVPDelegate::onCaptureScreen callback.

See also
AVPDelegate::onCaptureScreen

◆ start

- (void) start

Start playing.

You must call prepare before calling this method. Status changes are notified via AVPDelegate::onPlayerStatusChanged. If the player is already playing, this call has no effect.

See also
AVPDelegate::onPlayerStatusChanged
AVPStatus

Implemented in AVPLiveTimeShift.

◆ stop

- (void) stop

Stop playback.

Stops the current playback. Status changes are notified via AVPDelegate::onPlayerStatusChanged. After stopping, player resources are not automatically released. Call destroy or destroyAsync.

See also
AVPDelegate::onPlayerStatusChanged
AVPStatus
- destroy
- destroyAsync

Implemented in AliListPlayer, and AVPLiveTimeShift.

◆ switchStream:

- (void) switchStream: (NSString *) URL

Multi definition stream switch by url.

You can get result from AVPDelegate onStreamSwitchedSuccess/onStreamSwitchedFail.

Parameters
urlnew url address Note:
  1. Must be aliyun's live stream address.
  2. Must be different definition of the same stream.
  3. If switch to an unrelated address, switch may failed.

◆ updateFilterConfig:options:

- (void) updateFilterConfig: (NSString *) target
options: (AVPFilterOptions *) options 

Update filter configuration.

Dynamically updates parameters of configured filters. This method can be called during playback without re-preparing.

Parameters
targetFilter target specifying the name of the filter to update
optionsFilter option parameters containing new filter configuration values
See also
AVPFilterOptions
setFilterConfig

◆ updateLiveStsInfo:accKey:token:region:

- (void) updateLiveStsInfo: (NSString *) accId
accKey: (NSString *) accKey
token: (NSString *) token
region: (NSString *) region 

Update LiveStsInfo.

Parameters
accIdthe AccessKey ID for authentication.
accKeythe AccessKey Secret for authentication.
tokensecurityToken The specified token.
regionThe specified regions.

Property Documentation

◆ __deprecated

- (id<CicadaRenderDelegate> renderDelegate) __deprecated
readwritenonatomicweak

Set the render callback.

Deprecated, use the renderingDelegate.

Deprecated

◆ alphaRenderMode

- (AVPAlphaRenderMode) alphaRenderMode
readwritenonatomicassign

Set alpha render mode, can be used on gift play on live stream, etc.

Detail usage: doc

See also
AVPAlphaRenderMode 默认值AVPAlphaRenderMode.AVP_RENDERMODE_ALPHA_NONE

◆ autoPlay

- (BOOL) autoPlay
readwritenonatomicassign

Enable or disable autoplay.

When enabled, playback starts automatically after preparation completes. KVO is supported.

◆ bufferedPosition

- (int64_t) bufferedPosition
readnonatomicassign

Buffered position.

Read-only property querying the currently buffered playback position in milliseconds. Supports KVO observing. Used for displaying buffer progress bar; always greater than or equal to current position.

See also
AVPDelegate::onBufferedPositionUpdate

◆ currentDownloadSpeed

- (int64_t) currentDownloadSpeed
readnonatomicassign

Current network download speed.

Read-only property querying current download speed in bits per second (bps). Supports KVO observing. Speed updates in real-time during playback for network speed display.

See also
AVPDelegate::onCurrentDownloadSpeed

◆ currentPosition

- (int64_t) currentPosition
readnonatomicassign

Current playback position.

Read-only property querying the current playback position in milliseconds. Supports KVO observing. Position updates in real-time during playback, can be also collected by AVPDelegate::onCurrentPositionUpdate callback.

See also
AVPDelegate::onCurrentPositionUpdate

◆ currentUtcTime

- (int64_t) currentUtcTime
readnonatomicassign

Query the current playback utc time.

KVO is supported.

◆ delegate

- (id<AVPDelegate>) delegate
readwritenonatomicweak

Player delegate.

Sets or queries the player's delegate object. Delegate receives various event callbacks from the player such as preparation completion, errors, track information, etc. Uses weak reference to avoid circular references.

See also
AVPDelegate

◆ drmDelegate

- (id<AVPDrmDelegate>) drmDelegate
readwritenonatomicweak

DRM delegate.

Sets or queries the delegate for DRM (Digital Rights Management) related requests. This delegate is only triggered when playing via URL; VidAuth and VidSts methods do not trigger it. Currently supports Fairplay DRM only. Uses weak reference to avoid circular references.

See also
AVPDrmDelegate

◆ duration

- (int64_t) duration
readnonatomicassign

Playback duration.

Read-only property querying the total duration of the current media in milliseconds. Supports KVO observing. Valid only after media information is loaded.

◆ enableHardwareDecoder

- (BOOL) enableHardwareDecoder
readwritenonatomicassign

Hardware decoding enabled state.

Enables or disables hardware video decoding. Hardware decoding improves decoding efficiency but may not support certain codec formats. If hardware decoding fails, the player automatically falls back to software decoding. With adaptive fallback callback configured (AliPlayerGlobalSettings::setAdaptiveDecoderGetBackupURLCallback), can further degrade to different codec streams (e.g., H.265 to H.264).

Note
Hardware decoding is enabled by default

◆ eventReportParamsDelegate

- (id<AVPEventReportParamsDelegate>) eventReportParamsDelegate
readwritenonatomicweak

Set the event report callback.

See also
AVPEventReportParamsDelegate

◆ height

- (int) height
readnonatomicassign

Query the height of the video.

KVO is supported.

◆ localCacheLoadedSize

- (int64_t) localCacheLoadedSize
readnonatomicassign

Local cache hit size.

Read-only property querying the size of local cached file used at playback start in bytes. Value greater than 0 indicates cache hit and playback uses cached file. Supports KVO observing.

See also
AVPDelegate::onLocalCacheLoaded

◆ loop

- (BOOL) loop
readwritenonatomicassign

Enable or disable loop playback.

KVO is supported.

◆ mirrorMode

- (AVPMirrorMode) mirrorMode
readwritenonatomicassign

Set a mirroring mode.

KVO is supported.

See also
AVPMirrorMode

◆ muted

- (BOOL) muted
readwritenonatomicassign

Mute or unmute the player.

KVO is supported.

◆ outputAudioChannel

- (AVPOutputAudioChannel) outputAudioChannel
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.

See also
AVPOutputAudioChannel

◆ playerStatus

- (AVPStatus) playerStatus
readnonatomicassign

Player status.

Read-only property querying the current player status. Supports KVO observing. Status changes are notified via AVPDelegate::onPlayerStatusChanged.

See also
AVPStatus
AVPDelegate::onPlayerStatusChanged

◆ playerView

- (AVPView*) playerView
readwritenonatomicstrong

Set a player view (playerView).

AVPView: Mac platform: NSOpenGLView. iOS platform: UIView.

◆ rate

- (float) rate
readwritenonatomicassign

Set the playback speed.

Value 1 indicates normal speed. KVO is supported.

◆ renderingDelegate

- (id<CicadaRenderingDelegate>) renderingDelegate
readwritenonatomicweak

Video rendering delegate (new).

Sets or queries the delegate for video rendering events. Uses weak reference to avoid circular references.

See also
CicadaRenderingDelegate

◆ rotateMode

- (AVPRotateMode) rotateMode
readwritenonatomicassign

Set a rotate mode.

KVO is supported.

See also
AVPRotateMode

◆ rotation

- (int) rotation
readnonatomicassign

Query the rotate angle of the video, which is retrieved from the video metadata.

KVO is supported.

◆ scalingMode

- (AVPScalingMode) scalingMode
readwritenonatomicassign

Set a zoom mode.

KVO is supported.

See also
AVPScalingMode

◆ volume

- (float) volume
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.

◆ width

- (int) width
readnonatomicassign

Query the width of the video.

KVO is supported.


The documentation for this class was generated from the following file: