AliyunPlayer v6.21.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 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< AVPDelegatedelegate
 Set a proxy.
 
int64_t duration
 Query the length of the video.
 
BOOL enableHardwareDecoder
 Enable or disable hardware decoding.
 
id< AVPEventReportParamsDelegateeventReportParamsDelegate
 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.
 

Method Documentation

◆ addExtSubtitle:

- (void) addExtSubtitle: (NSString *) URL

Add external subtitles.

Parameters
URLsubtitle address

◆ clearScreen

- (void) clearScreen

Clear screen.

◆ clearScreenSync

- (void) clearScreenSync

Clear screen sync.

◆ destroy

- (void) destroy

Sync delete the player.

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 

Modify player configuration.

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.

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

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

See also
AVPConfig

◆ getCurrentTrack:

- (AVPTrackInfo *) getCurrentTrack: (AVPTrackType) type

Query the track that is being played.

Parameters
typeTrack type.
See also
AVPTrackType

◆ getDeviceUUID

+ (NSString *) getDeviceUUID

Query device UUID.

◆ getMediaInfo

- (AVPMediaInfo *) getMediaInfo

Query media information, including track information.

◆ getOption:

- (NSString *) getOption: (AVPOption) key

Get player information.

Parameters
keyThe key
Returns
The information

◆ getPlayedDuration

- (int64_t) getPlayedDuration

@breif get played time, will not affected by seek

◆ getPlayer

- (void *) getPlayer

◆ getPlayerName

- (NSString *) getPlayerName

Get used player name.

◆ getPropertyString:

- (NSString *) getPropertyString: (AVPPropertyKey) key

Get information by key.

Parameters
keyThe enum of key
Returns
corresponding information, return "" if doesn't exist.

◆ getSDKVersion

+ (NSString *) getSDKVersion

Query the SDK version.

◆ getSubMediaInfo

- (AVPMediaInfo *) getSubMediaInfo

Query media sub stream information, including track information.

◆ getThumbnail:

- (void) getThumbnail: (int64_t) positionMs

Retrieve the thumbnail image at the specified position.

Parameters
positionMsThe specified position.

◆ getUserData

- (NSString *) getUserData

Get user data, and each player instance bind one.

◆ init

- (instancetype) init

Initialize the player.

Implemented in AliListPlayer, and AliVRPlayer.

◆ init:

- (instancetype) init: (NSString *) traceID

Initialize the player.

Parameters
traceIDA trace ID for debugging. Set as "DisableAnalytics" to disable report analytics data to server(not recommended).

Implemented in AliListPlayer, and AliVRPlayer.

◆ initPlayerComponent:function:

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

◆ invokeComponent:

- (int) invokeComponent: (NSString *) content

Send command to component.

Parameters
contentcommand content
Returns
< 0 on Error

◆ isFeatureSupport:

+ (BOOL) isFeatureSupport: (SupportFeatureType) type

judge whether support the type of feature.

Parameters
typeThe type of the support feature. See SupportFeatureType.

◆ netWorkReConnect

+ (void) netWorkReConnect

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

◆ pause

- (void) pause

Pause.

◆ prepare

- (void) prepare

Prepare for playback.

Asynchronous callback.

◆ redraw

- (void) redraw

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

◆ reload

- (void) reload

Reload resources.

You can reload resources when the network connection times out.

◆ reset

- (void) reset

Reset.

◆ 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 external subtitles.

Parameters
trackIndexcaption index
enabletrue: select, false: close

◆ selectTrack:

- (void) selectTrack: (int) trackIndex

Switch definition according to the specified track index.

Parameters
trackIndexSpecify a definition index. SELECT_AVPTRACK_TYPE_VIDEO_AUTO: auto bitrate adjustment.

◆ selectTrack:accurate:

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

Switch definition according to the specified track index.

Parameters
trackIndexSpecify a definition index. SELECT_AVPTRACK_TYPE_VIDEO_AUTO: auto bitrate adjustment.
accurateUse accurate seeking to select track。

◆ sendCustomEvent:

- (void) sendCustomEvent: (NSString *) args

Send custom event, will callback through AVPEventReportParamsDelegate.

Event id e = 5001.

◆ setAudioSessionDelegate:

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

Set AudioSession Delegate.

Parameters
delegatethe Delegate

◆ setAuthSource:

- (void) setAuthSource: (AVPVidAuthSource *) source

Play by VID and playauth.

See https://help.aliyun.com/document_detail/57294.html

Parameters
sourceAVPVidAuthSource type.
See also
AVPVidAuthSource

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

◆ setConfig:

- (void) setConfig: (AVPConfig *) config

Modify player configuration.

Parameters
configAVPConfig type.
See also
AVPConfig

◆ setDefaultBandWidth:

- (void) setDefaultBandWidth: (int) bandWidth

Set the default playback bitrate for multi-bit rate.

The nearest stream will be selected.

Parameters
bandWidthbit rate .

◆ setEnableLog:

+ (void) setEnableLog: (BOOL) enableLog

Enable or disable logging.

Parameters
enableLogset as true to output log
See also
Use setLogCallbackInfo.

◆ setEventReportParamsDelegate:

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

◆ setFilterConfig:

- (void) setFilterConfig: (AVPFilterConfig *) filterConfig

Set filter config.

call this before prepare. If want update filter config, call updateFilterConfig()

Parameters
filterConfig

◆ setFilterInvalid:invalid:

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

disable/enable filter.

Parameters
targetif empty , disable all filters.
invalidtrue: enable(default); false: disable

◆ setLiveStsSource:

- (void) setLiveStsSource: (AVPLiveStsSource *) source

Play by 使用LiveSts.

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.

◆ setLogOption:value:

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

Set log option.

Parameters
logOptionoption logOption
valueoption value 0 represents off, 1 represents on

◆ setMaxAccurateSeekDelta:

- (void) setMaxAccurateSeekDelta: (int) delta

set the maximum interval of precision seek.

Parameters
deltainterval in milliseconds

◆ setMpsSource:

- (void) setMpsSource: (AVPVidMpsSource *) source

◆ setOption:value:

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

Set specified option.

◆ setOption:valueInt:

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

Set specified option.

◆ setPictureinPictureDelegate:

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

set delegate for picture in picture

Parameters
delegatepictureInPicture delegate

◆ setPictureInPictureEnable:

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

◆ setPictureInPictureShowMode:

- (void) setPictureInPictureShowMode: (AVPPIPShowMode) pipShowMode

set show mode for picture in picture

Parameters
delegatepictureInPicture show mode

◆ 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 preper player name.

Parameters
namepreper player name.

◆ setStartTime:seekMode:

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

Set a specified position as play start.Call this API before prepare, only take effect once.

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

◆ setStreamDelayTime:time:

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

set the delay time of the stream

Parameters
indexsteam index
timems

◆ setStsSource:

- (void) setStsSource: (AVPVidStsSource *) source

◆ setThumbnailUrl:

- (void) setThumbnailUrl: (NSString *) URL

Specify a thumbnail image URL.

Parameters
URLThe specified thumbnail image URL.

◆ setTraceID:

- (void) setTraceID: (NSString *) traceID

Set a trace ID for debugging.

Parameters
traceIDThe specified client connection trace ID.

◆ setUrlSource:

- (void) setUrlSource: (AVPUrlSource *) source

Play by URL.

Parameters
sourceAVPUrlSource type.
See also
AVPUrlSource

◆ setUserData:

- (void) setUserData: (NSString *) userData

Set user data, and will be passed to some global API, so that client can know from which player instance.

◆ setVerifyStsCallback:

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

Set the AVPStsInfo expiration callback.

Parameters
callback

◆ setVideoTag:size:

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

Set the video tags.

Values range from [0,99].

◆ snapShot

- (void) snapShot

Snapshot.

AVPImage: For a Mac platform, NSImage is returned. For an iOS platform, UIImage is returned.

◆ start

- (void) start

Start playing.

Implemented in AVPLiveTimeShift.

◆ stop

- (void) stop

Stop.

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 

upadate filter config.

Parameters
target
options

◆ updateLiveStsInfo:accKey:token:region:

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

update liveSts info.

Property Documentation

◆ __deprecated

- (id<CicadaRenderDelegate> renderDelegate) __deprecated
readwritenonatomicweak

Set the render callback.

Deprecated, use the renderingDelegate.

◆ alphaRenderMode

- (AVPAlphaRenderMode) alphaRenderMode
readwritenonatomicassign

Set a rendering mode.

Support alpha at right, left, top and bottom. Default value is none.

See also
AVPAlphaRenderMode

◆ autoPlay

- (BOOL) autoPlay
readwritenonatomicassign

Enable or disable autoplay.

KVO is supported.

◆ bufferedPosition

- (int64_t) bufferedPosition
readnonatomicassign

Query the buffered position.

KVO is supported.

◆ currentDownloadSpeed

- (int64_t) currentDownloadSpeed
readnonatomicassign

Query the current download speed.

KVO is supported.

◆ currentPosition

- (int64_t) currentPosition
readnonatomicassign

Query the current playback position.

KVO is supported.

◆ currentUtcTime

- (int64_t) currentUtcTime
readnonatomicassign

Query the current playback utc time.

KVO is supported.

◆ delegate

- (id<AVPDelegate>) delegate
readwritenonatomicweak

Set a proxy.

See AVPDelegate.

See also
AVPDelegate

◆ duration

- (int64_t) duration
readnonatomicassign

Query the length of the video.

KVO is supported.

◆ enableHardwareDecoder

- (BOOL) enableHardwareDecoder
readwritenonatomicassign

Enable or disable hardware decoding.

KVO is supported.

◆ eventReportParamsDelegate

- (id<AVPEventReportParamsDelegate>) eventReportParamsDelegate
readwritenonatomicweak

Set the event report callback.

◆ height

- (int) height
readnonatomicassign

Query the height of the video.

KVO is supported.

◆ localCacheLoadedSize

- (int64_t) localCacheLoadedSize
readnonatomicassign

Query the current playback cached file size.

KVO is supported.

◆ 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

Query the player status.

KVO is supported.

◆ playerView

- (AVPView*) playerView
readwritenonatomicstrong

Set a player view (playerView).

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

◆ rate

- (float) rate
readwritenonatomicassign

Set the playback speed.

Valid values: 0.5 to 2.0. Value 1 indicates normal speed. KVO is supported.

◆ renderingDelegate

- (id<CicadaRenderingDelegate>) renderingDelegate
readwritenonatomicweak

Set the render callback.

◆ 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: