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 offlineUristring optionsObject <optional>
Player Options
-
remove(offlineUri)
-
Remove downloaded assest
Parameters:
Name Type Description offlineUristring Returns:
Remove Promise
- Type
- Promise
-
startDownload(assetId, channelId, programId, metadata, usePersistentLicense)
-
start download of asset or program
Parameters:
Name Type Argument Description assetIdany Identifier of the asset to load
channelIdany Identifier of the channel to load
programIdany Identifier of the program to load
metadataObject <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
usePersistentLicenseboolean <nullable>
(optional) use PersistentLicense default=true
Returns:
startDownload
- Type
- Promise
-
startDownloadSource(source, metadata, usePersistentLicense)
-
start download of a source
Parameters:
Name Type Argument Description sourcestring | Object The Source element of a video element
metadataObject <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
usePersistentLicenseboolean <nullable>
(optional) use PersistentLicense default=true
Returns:
StartDownloadSource Promise
- Type
- Promise
EMP Html5 Player 2