CLDownloader
Example
import {CLVideo} from '@castlabs/react-native-prestoplay';
Constructors
new CLDownloader()
new CLDownloader(): CLDownloader
Properties
instanceId
instanceId: null | string = null;
Methods
delete()
delete(): void
Deletes the selected download.
getLocalManifestUrl()
getLocalManifestUrl(): Promise<string>
Returns the local manifest file path. It could be used for offline playing.
Returns
The local file path of the manifest.
getProgress()
getProgress(): Promise<DownloadProgress>
Returns the progress of the selected download.
Returns
The progress of the selected download.
getState()
getState(): Promise<DownloadState>
Returns the selected download state.
Returns
The state of the download.
getTracks()
getTracks(): Promise<TrackSet>
Returns the available tracks to download.
Returns
The available tracks.
onComplete()
onComplete(callback): void
Binds an event handler to the download completed event.
Parameters
Parameter | Type | Description |
---|---|---|
callback | GenericCallback | A function to execute each time the event is triggered. |
onError()
onError(callback): void
Binds an event handler to the download error event.
Parameters
Parameter | Type | Description |
---|---|---|
callback | DownloadErrorCallback | A function to execute each time the event is triggered. |
onProgress()
onProgress(callback): void
Binds an event handler to the download progress event.
Parameters
Parameter | Type | Description |
---|---|---|
callback | DownloadProgressCallback | A function to execute each time the event is triggered. |
onStart()
onStart(callback): void
Binds an event handler to the download started event.
Parameters
Parameter | Type | Description |
---|---|---|
callback | GenericCallback | A function to execute each time the event is triggered. |
onStop()
onStop(callback): void
Binds an event handler to the download stopped event.
Parameters
Parameter | Type | Description |
---|---|---|
callback | GenericCallback | A function to execute each time the event is triggered. |
pause()
pause(): void
Pauses the selected download.
prepare()
prepare(config): Promise<TrackSet>
Creates a new download instance and selects it.
Parameters
Parameter | Type | Description |
---|---|---|
config | DownloadConfig | The download configuration |
Returns
The available tracks for download.
prepareById()
prepareById(id): Promise<DownloadProgress>
Selects the download instance by ID. A promise is rejected if the download doesn't exist.
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The ID of the existing download. |
Returns
The download progress.
See
resume()
resume(): void
Resumes the selected download.
start()
start(trackSelection): void
Starts downloading selected tracks.
Parameters
Parameter | Type | Description |
---|---|---|
trackSelection | TrackSelection | The selected tracks. |