new DownloadService(player [, options])
Download Service Plugin
This manages persistent offline data including storage, listing, and deleting stored manifests.
Playback of offline manifests are done through the Player using a special URI (see shaka.offline.OfflineUri).
First, check isSupported to see if offline is supported by the platform.
Second, listen to EmpPlayerEvents.DOWNLOAD_PROGRESS on the download plugin
Third, call startDownload(), remove(), or list() as needed.
Start playback with load().
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
player |
Player | The |
|
options |
Object |
<optional> |
The key/value store of player options. |
Extends
- videojs.Plugin
Members
-
isSupported
-
if offline is supported by the platform
-
offlineOperationInProgress
-
offlineOperationInProgress
Methods
-
cancel()
-
cancel
-
deleteAll()
-
Delete all
Returns:
deleteAll
- Type
- Promise
-
destroy()
-
destroy current download
-
dispose()
-
dispose DownloadService
-
list()
-
List all downloaded assests
Returns:
list
- Type
- Promise
-
load(offlineUri [, options])
-
Play downloaded assest
Parameters:
Name Type Argument Description offlineUri
string options
Object <optional>
Player Options
-
remove(offlineUri)
-
Remove downloaded assest
Parameters:
Name Type Description offlineUri
string Returns:
Remove Promise
- Type
- Promise
-
startDownload(assetId, channelId, programId, metadata, usePersistentLicense)
-
start download of asset or program
Parameters:
Name Type Argument Description assetId
any Identifier of the asset to load
channelId
any Identifier of the channel to load
programId
any Identifier of the program to load
metadata
Object <nullable>
(optional) An arbitrary object from the application that will be stored along-side the offline content. Use this for any application-specific metadata you need associated with the stored content. For details on the data types that can be stored here, please refer to https://goo.gl/h62coS
usePersistentLicense
boolean <nullable>
(optional) use PersistentLicense default=true
Returns:
startDownload
- Type
- Promise
-
startDownloadSource(source, metadata, usePersistentLicense)
-
start download of a source
Parameters:
Name Type Argument Description source
string | Object The Source element of a video element
metadata
Object <nullable>
(optional) An arbitrary object from the application that will be stored along-side the offline content. Use this for any application-specific metadata you need associated with the stored content. For details on the data types that can be stored here, please refer to https://goo.gl/h62coS
usePersistentLicense
boolean <nullable>
(optional) use PersistentLicense default=true
Returns:
StartDownloadSource Promise
- Type
- Promise