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

Media file downloader class. More...

#include "AliMediaDownloader.h"

Inheritance diagram for AliMediaDownloader:

Instance Methods

(void) - deleteFile
 Deletes the downloaded file associated with the current downloader instance.
(void) - destroy
 Destroys the downloader instance.
(AVDConfig *) - getConfig
 Gets the current download configuration.
(instancetype) - init
 Initializes a downloader instance.
(void) - prepareWithPlayAuth:
 Prepares for download using AVPVidAuthSource.
(void) - prepareWithVid:
 Prepares for download using AVPVidStsSource.
(void) - selectTrack:
 Selects the media track to be downloaded.
(void) - setConfig:
 Sets the download configuration.
(void) - setPlayUrlConvertCallback:
 Sets a callback function for converting playback URLs.
(void) - setSaveDirectory:
 Sets the save directory for downloaded files.
(void) - start
 Start downloading.
(void) - stop
 Stop downloading.
(void) - updateWithPlayAuth:
 Updates the VidAuthSource information.
(void) - updateWithVid:
 Updates the VidStsSource information.

Class Methods

(int) + deleteFile:vid:format:index:
 Deletes a downloaded file (class method).
(NSString *) + getSDKVersion
 Gets the SDK version number.

Properties

id< AMDDelegatedelegate
 Sets the delegate for download events.
NSString * downloadedFilePath
 Gets the path of the downloaded file.

Detailed Description

Media file downloader class.

This class provides functionalities for downloading media files, including preparing, starting, stopping, updating credentials, and deleting. The status during the download process is reported via the AMDDelegate protocol.

Method Documentation

◆ deleteFile

- (void) deleteFile

Deletes the downloaded file associated with the current downloader instance.

◆ deleteFile:vid:format:index:

+ (int) deleteFile: (NSString *) saveDir
vid: (NSString *) vid
format: (NSString *) format
index: (int) index 

Deletes a downloaded file (class method).

Parameters
saveDirThe directory path where the file is saved.
vidThe VID of the media file.
formatThe format of the media file.
indexThe download index corresponding to the VID.
Returns
Returns an integer value indicating the result of the operation.

◆ destroy

- (void) destroy

Destroys the downloader instance.

Call this method to release resources held by the downloader.

◆ getConfig

- (AVDConfig *) getConfig

Gets the current download configuration.

Returns
The current AVDConfig configuration object.
See also
setConfig:]

◆ getSDKVersion

+ (NSString *) getSDKVersion

Gets the SDK version number.

Returns
A string containing the SDK version information.

◆ init

- (instancetype) init

Initializes a downloader instance.

Returns
An initialized AliMediaDownloader instance.

◆ prepareWithPlayAuth:

- (void) prepareWithPlayAuth: (AVPVidAuthSource *) source

Prepares for download using AVPVidAuthSource.

This is an asynchronous operation. Upon successful preparation, the onPrepared:mediaInfo:] callback will be triggered.

Parameters
sourceThe AVPVidAuthSource object, containing the VID and PlayAuth credential information required for download.
See also
onPrepared:mediaInfo:]
onError:errorModel:]

◆ prepareWithVid:

- (void) prepareWithVid: (AVPVidStsSource *) source

Prepares for download using AVPVidStsSource.

This is an asynchronous operation. Upon successful preparation, the onPrepared:mediaInfo:] callback will be triggered.

Parameters
sourceThe AVPVidStsSource object, containing the VID and STS credential information required for download.
See also
onPrepared:mediaInfo:]
onError:errorModel:]

◆ selectTrack:

- (void) selectTrack: (int) trackIndex

Selects the media track to be downloaded.

Note
Available track indexes can be obtained from the AVPMediaInfo object in the onPrepared:mediaInfo:] callback.
Parameters
trackIndexThe index of the track to be downloaded.

◆ setConfig:

- (void) setConfig: (AVDConfig *) config

Sets the download configuration.

Parameters
configAn AVDConfig object containing download-related configurations.
See also
getConfig]

◆ setPlayUrlConvertCallback:

- (void) setPlayUrlConvertCallback: (PlayURLConverCallback) callback

Sets a callback function for converting playback URLs.

Note
This callback is typically used for URL address conversion in P2P scenarios.
Parameters
callbackA callback function pointer. Its specific signature (parameters and return value) is not defined in this file; please refer to its source definition.

◆ setSaveDirectory:

- (void) setSaveDirectory: (NSString *) dir

Sets the save directory for downloaded files.

Parameters
dirThe folder path to save the downloaded files.

◆ start

- (void) start

◆ stop

- (void) stop

Stop downloading.

See also
start]

◆ updateWithPlayAuth:

- (void) updateWithPlayAuth: (AVPVidAuthSource *) source

Updates the VidAuthSource information.

When the PlayAuth credential expires, call this method to update the credential information.

Parameters
sourceA new AVPVidAuthSource object containing the updated PlayAuth credential.

◆ updateWithVid:

- (void) updateWithVid: (AVPVidStsSource *) source

Updates the VidStsSource information.

When the STS credential expires, call this method to update the credential information.

Parameters
sourceA new AVPVidStsSource object containing the updated STS credentials.

Property Documentation

◆ delegate

- (id<AMDDelegate>) delegate
readwritenonatomicweak

Sets the delegate for download events.

See also
AMDDelegate

◆ downloadedFilePath

- (NSString*) downloadedFilePath
readnonatomicassign

Gets the path of the downloaded file.

Note
This property will have a valid value only after the download is complete (i.e., when the onCompletion:] callback is triggered).
Returns
A string representing the local path of the downloaded file. It may be nil or empty if the download is not complete.

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