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

媒体预加载管理器。 More...

#include "AliMediaLoaderV2.h"

Inheritance diagram for AliMediaLoaderV2:

Instance Methods

(NSString *) - addTask:listener:
 添加一个预加载任务。
 
(void) - cancelTask:
 取消指定任务 ID 的加载。
 
(void) - pauseTask:
 暂停指定任务 ID 的加载。
 
(void) - resumeTask:
 恢复指定任务 ID 的加载。
 

Class Methods

(instancetype) + shareInstance
 获取 AliMediaLoaderV2 的单例实例。
 

Detailed Description

媒体预加载管理器。

Media preload manager.

提供预加载任务的提交、控制和状态监控能力。这是一个单例类。

Provides capabilities for submitting, controlling, and monitoring the status of preload tasks. This is a singleton class.

Method Documentation

◆ addTask:listener:

- (NSString *) addTask: (AVPPreloadTask *) preloadTask
listener: (id< OnPreloadListener >) listener 

添加一个预加载任务。

此方法用于提交一个预加载任务,并为该任务指定一个状态回调监听器。操作是异步的。

Parameters
preloadTaskAVPPreloadTask 预加载任务对象,包含了数据源和需要加载的时长等信息。
listener实现了 OnPreloadListener 协议的监听器对象。任务状态发生变更时,会通过此监听器的方法进行通知。
Returns
返回一个唯一分配的任务 ID (taskId),可用于后续对该任务进行控制(如取消、暂停)和状态查询。

Adds a preload task.

This method is used to submit a preload task and specify a status callback listener for it. The operation is asynchronous.

Parameters
preloadTaskThe AVPPreloadTask object, which contains information such as the data source and loading duration.
listenerA listener object that conforms to the OnPreloadListener protocol. When the task status changes, notifications will be sent through the methods of this listener.
Returns
Returns a uniquely assigned task ID (taskId), which can be used for subsequent control (e.g., cancel, pause) and status query of the task.

◆ cancelTask:

- (void) cancelTask: (NSString *) taskId

取消指定任务 ID 的加载。

Note
此操作不会删除已经下载到本地的文件,仅取消尚未完成部分的加载。成功取消后,会触发 onCanceled:urlOrVid:] 回调。
Parameters
taskId要取消加载的任务 ID,该 ID 由 addTask:listener:] 返回。

Cancels the loading for the specified task ID.

Note
This operation does not delete files that have already been downloaded locally; it only cancels the loading of the unfinished parts. Upon successful cancellation, the onCanceled:urlOrVid:] callback will be triggered.
Parameters
taskIdThe ID of the task to be canceled, which is returned by addTask:listener:] .

◆ pauseTask:

- (void) pauseTask: (NSString *) taskId

暂停指定任务 ID 的加载。

Parameters
taskId要暂停加载的任务 ID,该 ID 由 addTask:listener:] 返回。

Pauses the loading for the specified task ID.

Parameters
taskIdThe ID of the task to be paused, which is returned by addTask:listener:] .

◆ resumeTask:

- (void) resumeTask: (NSString *) taskId

恢复指定任务 ID 的加载。

用于继续一个之前被 pauseTask:] 暂停的任务。

Parameters
taskId要恢复加载的任务 ID,该 ID 由 addTask:listener:] 返回。
See also
pauseTask:]

Resumes the loading for the specified task ID.

Used to continue a task that was previously paused by pauseTask:] .

Parameters
taskIdThe ID of the task to be resumed, which is returned by addTask:listener:] .
See also
pauseTask:]

◆ shareInstance

+ (instancetype) shareInstance

获取 AliMediaLoaderV2 的单例实例。

Returns
AliMediaLoaderV2 的共享单例对象。

Gets the singleton instance of AliMediaLoaderV2.

Returns
The shared singleton object of AliMediaLoaderV2.

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