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

Media file preloader class. More...

#include "AliMediaLoader.h"

Inheritance diagram for AliMediaLoader:

Instance Methods

(void) - cancel:
 Cancels loading.
(void) - load:duration:
 Starts loading a file.
(void) - load:duration:defaultBandWidth:
 Starts loading a file, specifying the default bitrate.
(void) - load:duration:defaultResolutionProduct:
 Starts loading a file, specifying the default resolution.
(void) - pause:
 Pauses loading.
(void) - resume:
 Resumes loading.
(void) - setAliMediaLoaderStatusDelegate:
 Sets the status delegate.

Class Methods

(instancetype) + shareInstance
 Gets the singleton instance of AliMediaLoader.

Detailed Description

Media file preloader class.

Provides functionality to preload, cancel, pause, and resume media files. This is a singleton class.

Method Documentation

◆ cancel:

- (void) cancel: (NSString *) url

Cancels loading.

Note
This operation will not delete files that have already been downloaded locally. A successful cancellation will trigger the onCanceled:] callback.
Parameters
urlThe URL of the video file to cancel loading. If nil or an empty string, all ongoing loading tasks will be canceled.

◆ load:duration:

- (void) load: (NSString *) url
duration: (int64_t) duration 

Starts loading a file.

This is an asynchronous operation, and multiple files can be loaded simultaneously. For multi-bitrate streams, this method defaults to loading the lowest bitrate stream.

Note
Loading status will be notified through the callback methods in AliMediaLoaderStatusDelegate.
Parameters
urlThe URL of the video file to be loaded.
durationThe duration to load, in milliseconds.

◆ load:duration:defaultBandWidth:

- (void) load: (NSString *) url
duration: (int64_t) duration
defaultBandWidth: (int) defaultBandWidth 

Starts loading a file, specifying the default bitrate.

This is an asynchronous operation, and multiple files can be loaded simultaneously. When loading a multi-bitrate stream, the stream with the bitrate closest to the specified value will be selected.

Note
Loading status will be notified through the callback methods in AliMediaLoaderStatusDelegate.
Parameters
urlThe URL of the video file to be loaded.
durationThe duration to load, in milliseconds.
defaultBandWidthThe default bitrate specified for loading a multi-bitrate stream, in bps (bits per second). The SDK will select the bitrate stream closest to this value.

◆ load:duration:defaultResolutionProduct:

- (void) load: (NSString *) url
duration: (int64_t) duration
defaultResolutionProduct: (int64_t) defaultResolutionProduct 

Starts loading a file, specifying the default resolution.

This is an asynchronous operation, and multiple files can be loaded simultaneously. When loading a multi-bitrate stream, the stream with the resolution closest to the specified value will be selected. For example, if the value 1920 * 1080 = 2073600 is provided, the stream with the resolution closest to 1920x1080 will be preloaded.

Note
Loading status will be notified through the callback methods in AliMediaLoaderStatusDelegate.
Parameters
urlThe URL of the video file to be loaded.
durationThe duration to load, in milliseconds.
defaultResolutionProductThe product of the width and height of the desired resolution, used to select the closest resolution stream.

◆ pause:

- (void) pause: (NSString *) url

Pauses loading.

Parameters
urlThe URL of the video file to pause loading. If nil or an empty string, all ongoing loading tasks will be paused.

◆ resume:

- (void) resume: (NSString *) url

Resumes loading.

Parameters
urlThe URL of the video file to resume loading. If nil or an empty string, all paused loading tasks will be resumed.

◆ setAliMediaLoaderStatusDelegate:

- (void) setAliMediaLoaderStatusDelegate: (id< AliMediaLoaderStatusDelegate >) delegate

Sets the status delegate.

By setting a delegate, you can listen for events such as errors, completion, and cancellation during the loading process.

Parameters
delegateAn object that conforms to the AliMediaLoaderStatusDelegate protocol.
See also
AliMediaLoaderStatusDelegate

◆ shareInstance

+ (instancetype) shareInstance

Gets the singleton instance of AliMediaLoader.

Returns
The shared instance of AliMediaLoader.

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