Constructor
new Storage(playeropt, non-null)
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 support() to see if offline is supported by the platform. Second, configure() the storage object with callbacks to your application. Third, call store(), remove(), or list() as needed. When done, call destroy().
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
player |
shaka.Player |
<optional> |
A player instance to share a networking engine and configuration with. When initializing with a player, storage is only valid as long as |destroy| has not been called on the player instance. When omitted, storage will manage its own networking engine and configuration. |
- Implements:
- Source:
Members
activeDownloads_ :Map<string, {downloader: !shaka.offline.DownloadManager, ended: !Promise}>
The downloads of stored content in progress in this page, by content URI.
Type:
- Map<string, {downloader: !shaka.offline.DownloadManager, ended: !Promise}>
- Source:
activeStores_ :number
The number of store() and resume() operations in progress in this page,
across all Storage instances.
Type:
- number
- Source:
CONTENT_LOCK_PREFIX_ :string
The prefix of the name of the Web Lock held while a piece of content is
being downloaded. The rest of the name is the URI of the content.
Type:
- string
- Source:
storesStarted_ :number
The number of store() and resume() operations started in this page, across
all Storage instances.
Type:
- number
- Source:
STORING_LOCK_ :string
The name of the Web Lock shared by all the downloads in progress.
Type:
- string
- Source:
nextExternalStreamId_ :number
Contains an ID for use with creating streams. The manifest parser should
start with small IDs, so this starts with a large one.
Type:
- number
- Source:
openDownloadManagers_ :Array<!shaka.offline.DownloadManager>
A list of open download managers that are being used to download things.
Type:
- Array<!shaka.offline.DownloadManager>
- Source:
openOperations_ :Array<!Promise>
A list of open operations that are being performed by this instance of
|shaka.offline.Storage|.
Type:
- Array<!Promise>
- Source:
Methods
assignSegmentsToManifest(storage, manifestId, manifestDBnon-null, manifestUpdatesnon-null, dataSizeUpdate, throwIfAbortedFn) → {Promise}
Updates the given manifest, assigns database keys to segments, then stores
the updated manifest.
It is up to the caller to ensure that this method is not called
concurrently on the same manifest.
Parameters:
| Name | Type | Description |
|---|---|---|
storage |
shaka.extern.StorageCell | |
manifestId |
number | |
manifestDB |
shaka.extern.ManifestDB | |
manifestUpdates |
Object<string, number> | |
dataSizeUpdate |
number | |
throwIfAbortedFn |
function() | A function that should throw if the download has been aborted. |
- Source:
Returns:
- Type
- Promise
cleanStoredManifest(manifestId) → {Promise}
Removes all of the contents for a given manifest, statelessly.
Parameters:
| Name | Type | Description |
|---|---|---|
manifestId |
number |
- Source:
Returns:
- Type
- Promise
deleteAll() → {Promise}
Delete the on-disk storage and all the content it contains. This should not
be done in normal circumstances. Only do it when storage is rendered
unusable, such as by a version mismatch. No business logic will be run, and
licenses will not be released.
- Source:
Returns:
- Type
- Promise
deleteLicenseFor_(netnon-null, drmConfignon-null, muxernon-null, manifestDb) → {Promise}
Parameters:
| Name | Type | Description |
|---|---|---|
net |
shaka.net.NetworkingEngine | |
drmConfig |
shaka.extern.DrmConfiguration | |
muxer |
shaka.offline.StorageMuxer | |
manifestDb |
shaka.extern.ManifestDB |
- Source:
Returns:
- Type
- Promise
findSegmentsToResume_(contentUri, manifestDB, manifest, downloadernon-null, config) → {Array<!shaka.offline.DownloadInfo>}
Finds, in a new copy of the manifest, the segments of stored content that
are not stored yet.
Parameters:
| Name | Type | Description |
|---|---|---|
contentUri |
string | |
manifestDB |
shaka.extern.ManifestDB | |
manifest |
shaka.extern.Manifest | |
downloader |
shaka.offline.DownloadManager | |
config |
shaka.extern.PlayerConfiguration |
- Source:
Returns:
- Type
- Array<!shaka.offline.DownloadInfo>
findStreamToResume_(streamDB, streamsnon-null) → {shaka.extern.Stream}
Finds the stream of a new copy of the manifest that a stored stream was
made from. The IDs of the streams may change between copies of the
manifest, and so may their original IDs, which are URIs in HLS, so the
streams are compared by their properties first.
Parameters:
| Name | Type | Description |
|---|---|---|
streamDB |
shaka.extern.StreamDB | |
streams |
Array<shaka.extern.Stream> |
- Source:
Returns:
- Type
- shaka.extern.Stream
forEachSegment_(stream, startTime, callback)
Parameters:
| Name | Type | Description |
|---|---|---|
stream |
shaka.extern.Stream | |
startTime |
number | |
callback |
function(!shaka.media.SegmentReference, number) |
- Source:
getAllSegmentIds_(manifest) → {Array<number>}
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.ManifestDB |
- Source:
Returns:
- Type
- Array<number>
getAllStreamsFromManifest_(manifest) → {Set<shaka.extern.Stream>}
Get the set of all streams in |manifest|.
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.Manifest |
- Source:
Returns:
- Type
- Set<shaka.extern.Stream>
getCapabilities_(manifestDb, isVideo) → {Array<MediaKeySystemMediaCapability>}
Parameters:
| Name | Type | Description |
|---|---|---|
manifestDb |
shaka.extern.ManifestDB | |
isVideo |
boolean |
- Source:
Returns:
- Type
- Array<MediaKeySystemMediaCapability>
getStoredInitSegmentKeys_(manifestDB) → {Array<number>}
Parameters:
| Name | Type | Description |
|---|---|---|
manifestDB |
shaka.extern.ManifestDB |
- Source:
Returns:
The keys of the init segments already stored.
- Type
- Array<number>
isDownloading(contentUri) → {Promise<boolean>}
Parameters:
| Name | Type | Description |
|---|---|---|
contentUri |
string |
- Source:
Returns:
Whether the given content is being downloaded
in this page or, where the Web Locks API is available, in another page
of the same origin.
- Type
- Promise<boolean>
isStoring_() → {Promise<boolean>}
- Source:
Returns:
Whether content is being downloaded in this
page or, where the Web Locks API is available, in another page of the
same origin.
- Type
- Promise<boolean>
makeEstimator_(manifest) → {shaka.offline.StreamBandwidthEstimator}
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.Manifest |
- Source:
Returns:
makeExternalSegmentRef_(segmentDB) → {shaka.media.SegmentReference}
Makes the reference to a segment of an external stream from its ref ID,
which holds its URIs and byte range.
Parameters:
| Name | Type | Description |
|---|---|---|
segmentDB |
shaka.extern.SegmentDB |
- Source:
Returns:
markDownloadStarted_(contentUri, downloadernon-null) → {Promise<function()>}
Marks content as being downloaded by this page, so that its download can
be paused, and so that it is not resumed at the same time by this page or,
where the Web Locks API is available, by another page.
Parameters:
| Name | Type | Description |
|---|---|---|
contentUri |
string | |
downloader |
shaka.offline.DownloadManager |
- Source:
Returns:
Resolved with a function to call once the
download has ended.
- Type
- Promise<function()>
prepareDrm_(manifest, config) → {boolean}
Configures the clear keys of |manifest|, and decides whether its licenses
should be persistent.
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.Manifest | |
config |
shaka.extern.PlayerConfiguration |
- Source:
Returns:
- Type
- boolean
putAllSegmentIdsIntoSet_(manifest, idsnon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.ManifestDB | |
ids |
Set<number> |
- Source:
requestLock_(name, modenon-null) → {Promise<?function()>}
Requests a Web Lock without waiting for it.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | |
mode |
LockMode |
- Source:
Returns:
Resolved with a function that releases
the lock, or with null if the lock is held elsewhere. Without the Web
Locks API, resolved with a function that does nothing.
- Type
- Promise<?function()>
support() → {boolean}
Gets whether offline storage is supported. Returns true if offline storage
is supported for clear content. Support for offline storage of encrypted
content will not be determined until storage is attempted.
- Source:
Returns:
- Type
- boolean
updateManifestDrmFields_(manifestDB, drmEnginenon-null, usePersistentLicense)
Copies the expiration and the persistent session IDs from the DRM engine.
Unlike setManifestDrmFields_, this does not require the sessions to exist,
so it can be used while the content is being downloaded.
Parameters:
| Name | Type | Description |
|---|---|---|
manifestDB |
shaka.extern.ManifestDB | |
drmEngine |
shaka.drm.DrmEngine | |
usePersistentLicense |
boolean |
- Source:
validateManifest_(manifest)
Go over a manifest and issue warnings for any suspicious properties.
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.Manifest |
- Source:
configure(config, valueopt) → {boolean}
Sets configuration values for Storage. This is associated with
Player.configure and will change the player instance given at
initialization.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
config |
string | Object | This should either be a field name or an object following the form of shaka.extern.PlayerConfiguration, where you may omit any field you do not wish to change. | |
value |
* |
<optional> |
This should be provided if the previous parameter was a string field name. |
- Source:
Returns:
- Type
- boolean
createDrmEngine(manifest, onError, config, usePersistentLicense) → {Promise<!shaka.drm.DrmEngine>}
This method is public so that it can be override in testing.
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.Manifest | |
onError |
function(shaka.util.Error) | |
config |
shaka.extern.PlayerConfiguration | |
usePersistentLicense |
boolean |
- Source:
Returns:
- Type
- Promise<!shaka.drm.DrmEngine>
createExternalImageStream_(uri, manifest) → {Promise<shaka.extern.Stream>}
Parameters:
| Name | Type | Description |
|---|---|---|
uri |
string | |
manifest |
shaka.extern.Manifest |
- Source:
Returns:
- Type
- Promise<shaka.extern.Stream>
createExternalTextStream_(manifest, uri, language, kind, mimeTypeopt, codecopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
manifest |
shaka.extern.Manifest | ||
uri |
string | ||
language |
string | ||
kind |
string | ||
mimeType |
string |
<optional> |
|
codec |
string |
<optional> |
- Source:
createStream_(downloadernon-null, estimator, manifest, stream, config, toDownloadnon-null) → {shaka.extern.StreamDB}
Converts a manifest stream to a database stream. This will search the
segment index and add all the segments to the download infos.
Parameters:
| Name | Type | Description |
|---|---|---|
downloader |
shaka.offline.DownloadManager | |
estimator |
shaka.offline.StreamBandwidthEstimator | |
manifest |
shaka.extern.Manifest | |
stream |
shaka.extern.Stream | |
config |
shaka.extern.PlayerConfiguration | |
toDownload |
Map<string, !shaka.offline.DownloadInfo> |
- Source:
Returns:
createStreams_(downloadernon-null, estimator, drmEnginenon-null, manifest, config) → {{streams: !Array<shaka.extern.StreamDB>, toDownload: !Array<!shaka.offline.DownloadInfo>}}
Converts manifest Streams to database Streams.
Parameters:
| Name | Type | Description |
|---|---|---|
downloader |
shaka.offline.DownloadManager | |
estimator |
shaka.offline.StreamBandwidthEstimator | |
drmEngine |
shaka.drm.DrmEngine | |
manifest |
shaka.extern.Manifest | |
config |
shaka.extern.PlayerConfiguration |
- Source:
Returns:
- Type
- {streams: !Array<shaka.extern.StreamDB>, toDownload: !Array<!shaka.offline.DownloadInfo>}
destroy() → {Promise}
Request that this object be destroyed, releasing all resources and shutting
down all operations. Returns a Promise which is resolved when destruction
is complete. This Promise should never be rejected.
- Implements:
- Source:
Returns:
- Type
- Promise
downloadSegments_(toDownloadnon-null, manifestId, manifestDB, downloadernon-null, config, storage, manifest, drmEnginenullable, usePersistentLicense) → {Promise}
Download and then store the contents of each segment.
The promise this returns will wait for local downloads.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
toDownload |
Array<!shaka.offline.DownloadInfo> | ||
manifestId |
number | ||
manifestDB |
shaka.extern.ManifestDB | ||
downloader |
shaka.offline.DownloadManager | ||
config |
shaka.extern.PlayerConfiguration | ||
storage |
shaka.extern.StorageCell | ||
manifest |
shaka.extern.Manifest | ||
drmEngine |
shaka.drm.DrmEngine |
<nullable> |
Null if the licenses do not need to be stored. |
usePersistentLicense |
boolean |
- Source:
Returns:
Resolved once the segments are stored, or once the
segments downloaded so far are stored, if the download is paused.
- Type
- Promise
ensureNotDestroyed_()
Throws an error if the object is destroyed.
- Source:
filterManifest_(manifest, drmEnginenon-null, config, usePersistentLicense) → {Promise}
Filter |manifest| such that it will only contain the variants and text
streams that we want to store and can actually play.
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.Manifest | |
drmEngine |
shaka.drm.DrmEngine | |
config |
shaka.extern.PlayerConfiguration | |
usePersistentLicense |
boolean |
- Source:
Returns:
- Type
- Promise
getConfiguration() → {shaka.extern.PlayerConfiguration}
Return a copy of the current configuration. Modifications of the returned
value will not affect the Storage instance's active configuration. You
must call storage.configure() to make changes.
- Source:
Returns:
getManifestIncludesInitData_(manifest) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.Manifest |
- Source:
Returns:
- Type
- boolean
getManifestIsEncrypted_(manifest) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.Manifest |
- Source:
Returns:
- Type
- boolean
getNetworkingEngine() → {shaka.net.NetworkingEngine}
Return the networking engine that storage is using. If storage was
initialized with a player instance, then the networking engine returned
will be the same as |player.getNetworkingEngine()|.
The returned value will only be null if |destroy| was called before
|getNetworkingEngine|.
- Source:
Returns:
getTextData_(uri, netEnginenon-null, retryParams) → {Promise<BufferSource>}
Parameters:
| Name | Type | Description |
|---|---|---|
uri |
string | |
netEngine |
shaka.net.NetworkingEngine | |
retryParams |
shaka.extern.RetryParameters |
- Source:
Returns:
- Type
- Promise<BufferSource>
getTextMimetype_(uri) → {Promise<string>}
Parameters:
| Name | Type | Description |
|---|---|---|
uri |
string |
- Source:
Returns:
- Type
- Promise<string>
list() → {Promise<!Array<shaka.extern.StoredContent>>}
Lists all the stored content available.
- Source:
Returns:
A Promise to an
array of structures representing all stored content. The "offlineUri"
member of the structure is the URI that should be given to Player.load()
to play this piece of content offline. The "appMetadata" member is the
appMetadata argument you passed to store().
- Type
- Promise<!Array<shaka.extern.StoredContent>>
list_() → {Promise<!Array<shaka.extern.StoredContent>>}
See |shaka.offline.Storage.list| for details.
- Source:
Returns:
- Type
- Promise<!Array<shaka.extern.StoredContent>>
makeManifestDB_(drmEnginenon-null, manifest, uri, metadatanon-null, config, downloadernon-null, usePersistentLicense) → {{manifestDB: shaka.extern.ManifestDB, toDownload: !Array<!shaka.offline.DownloadInfo>, pendingContent: shaka.extern.StoredContent}}
Create a download manager and download the manifest.
This also sets up download infos for each segment to be downloaded.
Parameters:
| Name | Type | Description |
|---|---|---|
drmEngine |
shaka.drm.DrmEngine | |
manifest |
shaka.extern.Manifest | |
uri |
string | |
metadata |
Object | |
config |
shaka.extern.PlayerConfiguration | |
downloader |
shaka.offline.DownloadManager | |
usePersistentLicense |
boolean |
- Source:
Returns:
- Type
- {manifestDB: shaka.extern.ManifestDB, toDownload: !Array<!shaka.offline.DownloadInfo>, pendingContent: shaka.extern.StoredContent}
parseManifest(uri, parser, config) → {Promise<shaka.extern.Manifest>}
This method is public so that it can be overridden in testing.
Parameters:
| Name | Type | Description |
|---|---|---|
uri |
string | |
parser |
shaka.extern.ManifestParser | |
config |
shaka.extern.PlayerConfiguration |
- Source:
Returns:
- Type
- Promise<shaka.extern.Manifest>
pause(contentUri) → {Promise}
Pauses the download of stored content, started with store() or resume()
in this page.
The segments downloaded so far are kept, and the content is listed with
isIncomplete set to true until its download is resumed with
resume(). The operation that was downloading the content resolves with
it, instead of finishing the download.
The URI of the content is the offlineUri given to the
progress callback, which is set once the content has been created in
storage, before its segments are downloaded. Downloads running in other
pages cannot be paused.
Parameters:
| Name | Type | Description |
|---|---|---|
contentUri |
string |
- Source:
Returns:
Resolved once the download has stopped, and what it
downloaded has been stored. If the content is not being downloaded in
this page, it does nothing.
- Type
- Promise
pause_(contentUri) → {Promise}
See |shaka.offline.Storage.pause| for details.
Parameters:
| Name | Type | Description |
|---|---|---|
contentUri |
string |
- Source:
Returns:
- Type
- Promise
remove(contentUri) → {Promise}
Removes the given stored content. This will also attempt to release the
licenses, if any.
Parameters:
| Name | Type | Description |
|---|---|---|
contentUri |
string |
- Source:
Returns:
- Type
- Promise
remove_(contentUri) → {Promise}
See |shaka.offline.Storage.remove| for details.
Parameters:
| Name | Type | Description |
|---|---|---|
contentUri |
string |
- Source:
Returns:
- Type
- Promise
removeEmeSessions() → {Promise<boolean>}
Removes any orphaned EME sessions.
When DRM content is stored offline with a persistent session, the DRM
session ID is stored in the offline content database. When DRM content
gets deleted from the database, EME is asked to release the underlying
session attached to that ID.
If for some reason that fails, or if the browser is closed before that
asynchronous process is completed, session IDs must still be tracked in
the database. Otherwise, they would get orphaned and there would be no way
to discover them or clean them up.
This method will clean up any orphaned, persistent DRM sessions that the
database is still tracking. It should be called on application startup,
and will do nothing if there are no orphaned DRM sessions. It returns a
Promise that resolves to true if all the sessions were successfully
removed, or false if there are still sessions remaining.
- Source:
Returns:
- Type
- Promise<boolean>
removeEmeSessions_() → {Promise<boolean>}
- Source:
Returns:
- Type
- Promise<boolean>
removeFromDRM_(urinon-null, manifestDb, muxernon-null) → {Promise}
Parameters:
| Name | Type | Description |
|---|---|---|
uri |
shaka.offline.OfflineUri | |
manifestDb |
shaka.extern.ManifestDB | |
muxer |
shaka.offline.StorageMuxer |
- Source:
Returns:
- Type
- Promise
removeFromStorage_(storage, urinon-null, manifest) → {Promise}
Parameters:
| Name | Type | Description |
|---|---|---|
storage |
shaka.extern.StorageCell | |
uri |
shaka.offline.OfflineUri | |
manifest |
shaka.extern.ManifestDB |
- Source:
Returns:
- Type
- Promise
removeOrphanedSegments() → {Promise<number>}
Removes any orphaned segments.
Segments are written to the database as they are downloaded, and are
referenced by the stored content shortly after. If the page is closed or
the app is killed during a download, the segments written in between are
left in the database, taking up space, with no stored content to remove
them with.
This method finds the segments that no stored content references and
removes them. It should be called on application startup, and does
nothing if there are no orphaned segments. It returns a Promise that
resolves to the number of segments removed.
It must not be called while content is being stored, in this page or in
any other page of the same origin, since the segments of that download
would be removed. If a download is in progress in this page or, where the
Web Locks API is available, in another page, the Promise is rejected with
CANNOT_REMOVE_ORPHANS_WHILE_STORING.
The interrupted download itself is still listed, with
isIncomplete set to true, and can be removed with remove(),
which removes the segments it references too.
- Source:
Returns:
- Type
- Promise<number>
removeOrphanedSegments_() → {Promise<number>}
See |shaka.offline.Storage.removeOrphanedSegments| for details.
- Source:
Returns:
- Type
- Promise<number>
removeOrphans() → {Promise<boolean>}
Removes any orphaned segments and EME sessions.
This is the same as calling removeOrphanedSegments() and then
removeEmeSessions(), and has the same restrictions. It should be called on
application startup. It returns a Promise that resolves to true if all
the orphaned EME sessions were successfully removed, or false if there are
still sessions remaining.
- Source:
Returns:
- Type
- Promise<boolean>
removeOrphans_() → {Promise<boolean>}
See |shaka.offline.Storage.removeOrphans| for details.
- Source:
Returns:
- Type
- Promise<boolean>
requireSupport_()
Used by functions that need storage support to ensure that the current
platform has storage support before continuing. This should only be
needed to be used at the start of public methods.
- Source:
resume(contentUri, mimeTypeopt, nullable) → {shaka.extern.IAbortableOperation<shaka.extern.StoredContent>}
Resumes the download of incomplete stored content: content paused with
pause(), or content whose page was closed while it was being stored.
The manifest is downloaded again from its original URI, and only the
segments that are not stored yet are downloaded. The tracks are the ones
chosen when the content was stored, so they must still be in the
manifest. If they are not, the operation fails with
CANNOT_RESUME_CHANGED_CONTENT.
Content that is being downloaded in this page or, where the Web Locks API
is available, in another page of the same origin, cannot be resumed, and
the operation fails with CANNOT_RESUME_WHILE_STORING.
If the download fails, the content is kept so that it can be resumed
again. If it is aborted, the content is removed.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
contentUri |
string | ||
mimeType |
string |
<optional> <nullable> |
The mime type of the manifest, as given to store(). |
- Source:
Returns:
An AbortableOperation that resolves with the stored content once it has
been downloaded, or once its download has been paused again. If the
content is already complete, it resolves with it right away.
resume_(contentUri, mimeTypenullable, config, downloadernon-null) → {Promise<shaka.extern.StoredContent>}
See |shaka.offline.Storage.resume| for details.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
contentUri |
string | ||
mimeType |
string |
<nullable> |
|
config |
shaka.extern.PlayerConfiguration | ||
downloader |
shaka.offline.DownloadManager |
- Source:
Returns:
- Type
- Promise<shaka.extern.StoredContent>
setManifestDrmFields_(manifest, manifestDB, drmEnginenon-null, usePersistentLicense)
Parameters:
| Name | Type | Description |
|---|---|---|
manifest |
shaka.extern.Manifest | |
manifestDB |
shaka.extern.ManifestDB | |
drmEngine |
shaka.drm.DrmEngine | |
usePersistentLicense |
boolean |
- Source:
startAbortableOperation_(actionnon-null) → {shaka.extern.IAbortableOperation<T>}
The equivalent of startOperation_, but for abortable operations.
Parameters:
| Name | Type | Description |
|---|---|---|
action |
shaka.extern.IAbortableOperation<T> |
- Source:
Returns:
- Type
- shaka.extern.IAbortableOperation<T>
startDownloadOperation_(download) → {shaka.extern.IAbortableOperation<shaka.extern.StoredContent>}
Starts an operation that downloads content to storage, with store() or
resume().
Parameters:
| Name | Type | Description |
|---|---|---|
download |
function(!shaka.offline.DownloadManager): !Promise<shaka.extern.StoredContent> |
- Source:
Returns:
startOperation_(actionnon-null) → {Promise<T>}
Perform an action. Track the action's progress so that when we destroy
we will wait until all the actions have completed before allowing destroy
to resolve.
Parameters:
| Name | Type | Description |
|---|---|---|
action |
Promise<T> |
- Source:
Returns:
- Type
- Promise<T>
store(uri, appMetadataopt, non-null, mimeTypeopt, nullable, externalThumbnailsopt, nullable, externalTextopt, nullable) → {shaka.extern.IAbortableOperation<shaka.extern.StoredContent>}
Stores the given manifest. If the content is encrypted, and encrypted
content cannot be stored on this platform, the Promise will be rejected
with error code 6001, REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE.
Multiple assets can be downloaded at the same time, but note that since
the storage instance has a single networking engine, multiple storage
objects will be necessary if some assets require unique network filters.
This snapshots the storage config at the time of the call, so it will not
honor any changes to config mid-store operation.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
uri |
string | The URI of the manifest to store. | |
appMetadata |
Object |
<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://bit.ly/StructClone |
mimeType |
string |
<optional> <nullable> |
The mime type for the content |manifestUri| points to. |
externalThumbnails |
Array<string> |
<optional> <nullable> |
The external thumbnails to store along the main content. |
externalText |
Array<shaka.extern.ExtraText> |
<optional> <nullable> |
The external text to store along the main content. |
- Source:
Returns:
An AbortableOperation that resolves with a structure representing what
was stored. The "offlineUri" member is the URI that should be given to
Player.load() to play this piece of content offline. The "appMetadata"
member is the appMetadata argument you passed to store().
If you want to cancel this download, call the "abort" method on
AbortableOperation.
store_(uri, appMetadatanon-null, externalThumbnailsnon-null, externalTextnon-null, getParser, config, downloadernon-null) → {Promise<shaka.extern.StoredContent>}
See |shaka.offline.Storage.store| for details.
Parameters:
| Name | Type | Description |
|---|---|---|
uri |
string | |
appMetadata |
Object | |
externalThumbnails |
Array<string> | |
externalText |
Array<shaka.extern.ExtraText> | |
getParser |
function(): !Promise<shaka.extern.ManifestParser> | |
config |
shaka.extern.PlayerConfiguration | |
downloader |
shaka.offline.DownloadManager |
- Source:
Returns:
- Type
- Promise<shaka.extern.StoredContent>