AliyunPlayer v7.10.0
Aliyun Player API Reference Manual for iOS Platforms
Loading...
Searching...
No Matches
<AVPDelegate> Protocol Reference

#include "AVPDelegate.h"

Inheritance diagram for <AVPDelegate>:

Instance Methods

(void) - onBufferedPositionUpdate:position:
 Current cache position callback.
(void) - onCaptureScreen:image:
 Snapshot retrieval callback.
(int) - onChooseTrackIndex:info:
 Select the stream to play.
(void) - onCurrentDownloadSpeed:speed:
 current download speed callback.
(void) - onCurrentPositionUpdate:position:
 Current playback position callback.
(void) - onCurrentUtcTimeUpdate:time:
 Current playback utc time callback.
(void) - onError:errorModel:
 Proxy error callback.
(void) - onGetThumbnailFailed:
 Thumbnail image retrieval failure callback.
(void) - onGetThumbnailSuc:fromPos:toPos:image:
 Thumbnail image retrieval success callback.
(void) - onLoadingProgress:progress:
 Buffer progress callback, used to display Loading progress.
(void) - onLocalCacheLoaded:size:
 Video playback cache hit callback.
(void) - onNetworkStat:stat:
 Network stat information callback.
(void) - onPlayerEvent:eventType:
 Player event callback.
(void) - onPlayerEvent:eventWithString:description:
 Player event callback with string description.
(void) - onPlayerStatusChanged:oldStatus:newStatus:
 Player status update callback.
(void) - onSEIData:type:uuid:data:
 SEI callback.
(void) - onStreamSwitchedFail:URL:errorModel:
 Stream switch by url fail callback.
(void) - onStreamSwitchedSuccess:URL:
 Stream switch by url success callback.
(void) - onSubtitleExtAdded:trackIndex:URL:
 External subtitles have been added.
(void) - onSubtitleHeader:trackIndex:Header:
 Subtitle header information callback.
(void) - onSubtitleHide:trackIndex:subtitleID:
 Hide subtitle callback.
(void) - onSubtitleShow:trackIndex:subtitleID:subtitle:
 Show subtitle callback.
(void) - onSubTrackReady:info:
 Sub-stream track information callback.
(void) - onTrackChanged:info:
 Track switchover completion callback.
(void) - onTrackReady:info:
 Track information callback.
(void) - onUrlExpired:expiredUrl:callback:
 URL expired callback.
(void) - onURLSourceExpired:expiredSource:callback:
 URL source expired callback.
(void) - onVidAuthExpired:expiredSource:callback:
 VidAuth source expired callback.
(void) - onVideoRendered:timeMs:pts:
 Player render info callback.
(void) - onVideoSizeChanged:width:height:rotation:
 Video size change callback.

Method Documentation

◆ onBufferedPositionUpdate:position:

- (void) onBufferedPositionUpdate: (AliPlayer *) player
position: (int64_t) position 
optionalrequired

Current cache position callback.

Parameters
playerPlayer pointer.
positionCurrent cache position in milliseconds. Indicates the current buffered position, can be used to display buffer progress bar. The callback frequency can be adjusted via AVPConfig::positionTimerIntervalMs.
See also
AliPlayer::bufferedPosition

◆ onCaptureScreen:image:

- (void) onCaptureScreen: (AliPlayer *) player
image: (AVPImage *) image 
optionalrequired

Snapshot retrieval callback.

Triggered by Aliplayer::snapShot

Parameters
playerPlayer pointer.
imageSnapshot. For Mac platform, AVPImage is UIImage for iOS platform while it's NSImage for Mac platform.
See also
- snapShot (AliPlayer)

◆ onChooseTrackIndex:info:

- (int) onChooseTrackIndex: (AliPlayer *) player
info: (NSArray< AVPTrackInfo * > *) info 
optionalrequired

Select the stream to play.

Parameters
playerPlayer pointer.
infoAn array of track information, including video, audio, subtitle tracks, etc.
Returns
The index of the stream to play.
See also
AVPTrackInfo
AliPlayer::selectTrack

◆ onCurrentDownloadSpeed:speed:

- (void) onCurrentDownloadSpeed: (AliPlayer *) player
speed: (int64_t) speed 
optionalrequired

current download speed callback.

Parameters
playerPlayer pointer.
speedCurrent download speed in bits per second.
See also
AliPlayer::currentDownloadSpeed In live streaming, there will be data continuously; while in on-demand streaming, there may be no download speed because of the cache used, which is a normal situation.

◆ onCurrentPositionUpdate:position:

- (void) onCurrentPositionUpdate: (AliPlayer *) player
position: (int64_t) position 
optionalrequired

Current playback position callback.

Parameters
playerPlayer pointer.
positionCurrent playback position in milliseconds. Callback frequency: Default once per second, can be adjusted via configuration.
See also
AliPlayer::currentPosition

◆ onCurrentUtcTimeUpdate:time:

- (void) onCurrentUtcTimeUpdate: (AliPlayer *) player
time: (int64_t) time 
optionalrequired

Current playback utc time callback.

Parameters
playerPlayer pointer.
timeCurrent UTC time in milliseconds. Applicable to live streaming scenarios to get the UTC timestamp corresponding to the current playback content.
See also
AliPlayer::currentUtcTime

◆ onError:errorModel:

- (void) onError: (AliPlayer *) player
errorModel: (AVPErrorModel *) errorModel 
optionalrequired

Proxy error callback.

Parameters
playerPlayer pointer.
errorModelPlayer error description. See AVPErrorModel. Triggered when errors occur during playback, including network errors, decoding errors, file errors, etc.
See also
AVPErrorModel

◆ onGetThumbnailFailed:

- (void) onGetThumbnailFailed: (int64_t) positionMs
optionalrequired

Thumbnail image retrieval failure callback.

Parameters
positionMsThe specified thumbnail image position. Triggered after calling AliPlayer::getThumbnail fails.
See also
AliPlayer::getThumbnail

◆ onGetThumbnailSuc:fromPos:toPos:image:

- (void) onGetThumbnailSuc: (int64_t) positionMs
fromPos: (int64_t) fromPos
toPos: (int64_t) toPos
image: (id) image 
optionalrequired

Thumbnail image retrieval success callback.

Parameters
positionMsThe specified thumbnail image position.
fromPosThe initial position of the thumbnail image.
toPosThe end position of the thumbnail image.
imageThumbnail image pointer. Mac: NSImage. iOS: UIImage. Triggered after successfully calling AliPlayer::getThumbnail.
See also
AliPlayer::getThumbnail

◆ onLoadingProgress:progress:

- (void) onLoadingProgress: (AliPlayer *) player
progress: (float) progress 
optionalrequired

Buffer progress callback, used to display Loading progress.

Parameters
playerPlayer pointer.
progressBuffer progress: from 0 to 100, representing the percentage of buffer completion.

◆ onLocalCacheLoaded:size:

- (void) onLocalCacheLoaded: (AliPlayer *) player
size: (int64_t) size 
optionalrequired

Video playback cache hit callback.

Parameters
playerPlayer pointer.
sizeFile size, measured in bytes; a value greater than 0 indicates a cache hit, and the value represents the number of bytes hit the cache. Triggered when the player starts playback and uses a local cache file.
See also
AliPlayer::localCacheLoadedSize

◆ onNetworkStat:stat:

- (void) onNetworkStat: (AliPlayer *) player
stat: (AVPNetworkStat *) stat 
optionalrequired

Network stat information callback.

Currently only effective for Real-time Streaming(RTS)

Parameters
playerPlayer pointer.
statNetwork quality information, including packet loss rate, latency, etc.
See also
AVPNetworkStat

◆ onPlayerEvent:eventType:

- (void) onPlayerEvent: (AliPlayer *) player
eventType: (AVPEventType) eventType 
optional

Player event callback.

Parameters
playerPlayer pointer.
eventTypePlayer event type.
See also
AVPEventType

◆ onPlayerEvent:eventWithString:description:

- (void) onPlayerEvent: (AliPlayer *) player
eventWithString: (AVPEventWithString) eventWithString
description: (NSString *) description 
optionalrequired

Player event callback with string description.

Parameters
playerPlayer pointer.
eventWithStringPlayer event type string.
descriptionPlayer event detailed description.
See also
AVPEventType

◆ onPlayerStatusChanged:oldStatus:newStatus:

- (void) onPlayerStatusChanged: (AliPlayer *) player
oldStatus: (AVPStatus) oldStatus
newStatus: (AVPStatus) newStatus 
optionalrequired

Player status update callback.

Parameters
playerPlayer pointer.
oldStatusThe previous status. See AVPStatus.
newStatusThe updated status. See AVPStatus. Triggered when player status changes, including idle, prepared, started, paused, stopped, completed, error, etc.
See also
AVPStatus
AliPlayer::playerStatus

◆ onSEIData:type:uuid:data:

- (void) onSEIData: (AliPlayer *) player
type: (int) type
uuid: (NSData *) uuid
data: (NSData *) data 
optionalrequired

SEI callback.

Parameters
playerPlayer pointer.
typeType.
uuidData.(valid only when type=5, added in player sdk 6.11.0 and later)
dataData.(not included uuid part, the same semantic with player sdk 6.10.0 and before) Triggered when the decoder parses SEI data.

◆ onStreamSwitchedFail:URL:errorModel:

- (void) onStreamSwitchedFail: (AliPlayer *) player
URL: (NSString *) URL
errorModel: (AVPErrorModel *) errorModel 
optionalrequired

Stream switch by url fail callback.

Parameters
playerPlayer pointer.
URLSwitched url.
errorModelPlayer error description. See AVPErrorModel. Triggered after calling AliPlayer::switchStream fails.
See also
AliPlayer::switchStream

◆ onStreamSwitchedSuccess:URL:

- (void) onStreamSwitchedSuccess: (AliPlayer *) player
URL: (NSString *) URL 
optionalrequired

Stream switch by url success callback.

Parameters
playerPlayer pointer.
urlSwitched url. Triggered after successfully calling AliPlayer::switchStream. Note: Only applicable to Aliyun live streaming addresses for multi-definition switching.
See also
AliPlayer::switchStream

◆ onSubtitleExtAdded:trackIndex:URL:

- (void) onSubtitleExtAdded: (AliPlayer *) player
trackIndex: (int) trackIndex
URL: (NSString *) URL 
optionalrequired

External subtitles have been added.

Parameters
playerPlayer pointer.
trackIndexSubtitle track index.
URLsubtitle url Triggered after successfully calling AliPlayer::addExtSubtitle.
See also
AliPlayer::addExtSubtitle

◆ onSubtitleHeader:trackIndex:Header:

- (void) onSubtitleHeader: (AliPlayer *) player
trackIndex: (int) trackIndex
Header: (NSString *) header 
optionalrequired

Subtitle header information callback.

Used for formats like ASS subtitles that require header information. If this callback is implemented, the player will not automatically render subtitles, and the caller needs to handle subtitle rendering.

Parameters
playerPlayer instance pointer
trackIndexSubtitle track index
headerSubtitle header information content For external subtitle usage, refer to External Subtitles

◆ onSubtitleHide:trackIndex:subtitleID:

- (void) onSubtitleHide: (AliPlayer *) player
trackIndex: (int) trackIndex
subtitleID: (long) subtitleID 
optionalrequired

Hide subtitle callback.

Parameters
playerPlayer pointer.
trackIndexSubtitle stream index.
subtitleIDSubtitle ID. Triggered when subtitles need to be hidden.
See also
AliPlayer::selectExtSubtitle

◆ onSubtitleShow:trackIndex:subtitleID:subtitle:

- (void) onSubtitleShow: (AliPlayer *) player
trackIndex: (int) trackIndex
subtitleID: (long) subtitleID
subtitle: (NSString *) subtitle 
optionalrequired

Show subtitle callback.

Parameters
playerPlayer pointer.
trackIndexSubtitle stream index.
subtitleIDSubtitle ID.
subtitleSubtitle string. Triggered when subtitles need to be displayed.
See also
AliPlayer::selectExtSubtitle

◆ onSubTrackReady:info:

- (void) onSubTrackReady: (AliPlayer *) player
info: (NSArray< AVPTrackInfo * > *) info 
optionalrequired

Sub-stream track information callback.

Parameters
playerPlayer pointer.
infoAn array of sub-stream track information. Applicable to HLS packaged multi-bitrate streams.
See also
AVPTrackInfo
- getSubMediaInfo (AliPlayer)

◆ onTrackChanged:info:

- (void) onTrackChanged: (AliPlayer *) player
info: (AVPTrackInfo *) info 
optionalrequired

Track switchover completion callback.

Parameters
playerPlayer pointer.
infoTrack switchover completion information. See AVPTrackInfo. Triggered after calling AliPlayer::selectTrack and the switch is completed.
See also
AVPTrackInfo
AliPlayer::selectTrack

◆ onTrackReady:info:

- (void) onTrackReady: (AliPlayer *) player
info: (NSArray< AVPTrackInfo * > *) info 
optionalrequired

Track information callback.

Parameters
playerPlayer pointer.
infoAn array of track information, including video, audio, subtitle tracks, etc. Triggered after prepare is completed and media information is obtained.
See also
AVPTrackInfo
- getMediaInfo (AliPlayer)
- prepare (AliPlayer)

◆ onUrlExpired:expiredUrl:callback:

- (void) onUrlExpired: (AliPlayer *) player
expiredUrl: (NSString *) expiredUrl
callback: (id< AVPUrlRefreshCallback >) callback 
optionalrequired

URL expired callback.

Parameters
playerPlayer pointer.
expiredUrlExpired URL.
callbackURL refresh callback. Triggered when the player detects that the URL has expired, can be used to implement automatic URL refresh functionality.

◆ onURLSourceExpired:expiredSource:callback:

- (void) onURLSourceExpired: (AliPlayer *) player
expiredSource: (id) expiredSource
callback: (id< AVPSourceRefreshCallback >) callback 
optionalrequired

URL source expired callback.

Parameters
playerPlayer pointer.
expiredSourceExpired URL source object.
callbackSource refresh callback.

◆ onVidAuthExpired:expiredSource:callback:

- (void) onVidAuthExpired: (AliPlayer *) player
expiredSource: (id) expiredSource
callback: (id< AVPSourceRefreshCallback >) callback 
optionalrequired

VidAuth source expired callback.

Parameters
playerPlayer pointer.
expiredSourceExpired VidAuth source object.
callbackSource refresh callback.

◆ onVideoRendered:timeMs:pts:

- (void) onVideoRendered: (AliPlayer *) player
timeMs: (int64_t) timeMs
pts: (int64_t) pts 
optionalrequired

Player render info callback.

Parameters
playerPlayer pointer.
timeMssystem time when render in milliseconds.
ptsvideo frame pts Triggered when each video frame rendering is completed, can be used for frame-level monitoring and performance analysis.
See also
AliPlayer::setOnVideoRenderedListener

◆ onVideoSizeChanged:width:height:rotation:

- (void) onVideoSizeChanged: (AliPlayer *) player
width: (int) width
height: (int) height
rotation: (int) rotation 
optionalrequired

Video size change callback.

Parameters
playerPlayer pointer.
widthVideo width.
heightVideo height.
rotationVideo rotate angle. Triggered when video metadata is loaded or video resolution changes.

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