Class: shaka.util.ContentDatabaseReader

Constructor

new ContentDatabaseReader()

Creates a new ContentDatabaseReader.
Extends:
Source:

Members

(private, non-null) listeners_ :shaka.util.MultiMap.<shaka.util.FakeEventTarget.ListenerType>

Type:
Inherited From:
Source:

(private) mode_ :string

Type:
  • string
Inherited From:
Source:

(protected) parent :shaka.util.FakeEventTarget

Type:
Inherited From:
Source:

Methods

addEventListener(type, listener, opt_capturingopt)

Add an event listener to this object.
Parameters:
Name Type Attributes Description
type string The event type to listen for.
listener shaka.util.FakeEventTarget.ListenerType The callback or listener object to invoke.
opt_capturing boolean <optional>
True to listen during the capturing phase, false to listen during the bubbling phase. Note that FakeEventTarget does not support the capturing phase from the standard event model.
Inherited From:
Source:

closeDatabaseConnection()

Closes the connection to the database.
Inherited From:
Source:

(private) createStore_(name, options) → (non-null) {IDBObjectStore}

Creates an object store in the database. It will replace any previous object store with the same name in this database.
Parameters:
Name Type Description
name string The unique name of the object store.
options Object The options for this object store including keyPath and autoIncrement, other options will be ignored.
Inherited From:
Source:
Returns:
Type
IDBObjectStore

deleteDatabase() → (non-null) {Promise}

Closes the connection to the database if required and then deletes the database. The database can only be deleted if there are no other connections to the database.
Inherited From:
Source:
Returns:
Type
Promise

dispatchEvent(eventnon-null) → {boolean}

Dispatch an event from this object.
Parameters:
Name Type Description
event Event The event to be dispatched from this object.
Inherited From:
Source:
Returns:
True if the default action was prevented.
Type
boolean

(protected) getContentStore() → (non-null) {IDBObjectStore}

Opens a reference to the content store.
Inherited From:
Source:
Returns:
A reference to the content store.
Type
IDBObjectStore

(protected) getGroupStore() → (non-null) {IDBObjectStore}

Opens a reference to the group store.
Inherited From:
Source:
Returns:
A reference to the group store.
Type
IDBObjectStore

(protected) getIndexStore() → (non-null) {IDBObjectStore}

Opens a reference to the index store.
Inherited From:
Source:
Returns:
A reference to the index store.
Type
IDBObjectStore

(private) getStore_(storeName) → (non-null) {IDBObjectStore}

Opens a reference to a store.
Parameters:
Name Type Description
storeName string The name of a store in the database.
Inherited From:
Source:
Returns:
A reference to a store.
Type
IDBObjectStore

(private) recursiveDispatch_(eventnon-null) → {boolean}

Dispatches an event recursively without changing its original target.
Parameters:
Name Type Description
event Event
Inherited From:
Source:
Returns:
True if the default action was prevented.
Type
boolean

removeEventListener(type, listener, opt_capturingopt)

Remove an event listener from this object.
Parameters:
Name Type Attributes Description
type string The event type for which you wish to remove a listener.
listener shaka.util.FakeEventTarget.ListenerType The callback or listener object to remove.
opt_capturing boolean <optional>
True to remove a listener for the capturing phase, false to remove a listener for the bubbling phase. Note that FakeEventTarget does not support the capturing phase from the standard event model.
Inherited From:
Source:

retrieveGroup(groupId) → (non-null) {Promise.<shaka.util.ContentDatabase.GroupInformation>}

Retrieves the group for a stream from the database.
Parameters:
Name Type Description
groupId number The unique id of the group.
Source:
Returns:
The unique ids of the streams the group.
Type
Promise.<shaka.util.ContentDatabase.GroupInformation>

retrieveGroupIds() → (non-null) {Promise.<!Array.<number>>}

Retrieves an array of all stored group IDs.
Source:
Returns:
The unique IDs of all of the stored groups.
Type
Promise.<!Array.<number>>

(protected) retrieveItem(store, id) → (non-null) {Promise}

Retrieves an item from a store in the database.
Parameters:
Name Type Description
store IDBObjectStore | IDBIndex The store to request an item from.
id number | Array The unique id(s) of item in the store.
Inherited From:
Source:
Returns:
Type
Promise

retrieveSegment(streamId, segmentId) → (non-null) {Promise.<ArrayBuffer>}

Retrieves the segment with |segmentId| from the stream with |streamId| in the database.
Parameters:
Name Type Description
streamId number The unique id of the stream to retrieve.
segmentId number The id of the segment to retrieve.
Source:
Returns:
Type
Promise.<ArrayBuffer>

retrieveStreamIndex(streamId) → (non-null) {Promise.<shaka.util.ContentDatabase.StreamIndex>}

Retrieves the index for a stream from the database.
Parameters:
Name Type Description
streamId number The unique id of the stream.
Source:
Returns:
Type
Promise.<shaka.util.ContentDatabase.StreamIndex>

setUpDatabase() → (non-null) {Promise}

Opens a connection to the database and sets up the database if required. If a new version number is given the onupgradeneeded event will be fired. Must be run before any operations can be performed on the database. The database will have the structure: Group Store: { group_id: number stream_ids: Array. session_ids: Array. } Index Store: { stream_id: number, mime_type: string, references: [{shaka.util.ContentDatabase.SegmentInformation}] } Content Store: { stream_id: number, segment_id: number, content: ArrayBuffer }
Inherited From:
Source:
Returns:
Type
Promise