Class: shaka.metadata.Metadata

Constructor

new Metadata()

Source:

Members

parsersByMime_ :Map<string, !Array<shaka.extern.MetadataParser.Factory>>

Maps each MIME type to the ordered list of parser factories registered for it. A single MIME type may have multiple factories (e.g. ID3v2 + ID3v1 for {@code audio/mpeg}).
Type:
Source:

Methods

getMetadataFrames(datanon-null, mimeType) → {Array<!shaka.extern.MetadataFrame>}

Returns all metadata frames found in the media data for the given MIME type. The method invokes every parser factory that has been registered for {@code mimeType} via shaka.metadata.Metadata.registerParserByMime, collects all returned frames, and deduplicates them so that when multiple frames share the same {@code key} only the first occurrence is kept. The same MIME type may have more than one parser registered (e.g. both an ID3v2 and an ID3v1 parser for {@code audio/mpeg}). All registered parsers are run in registration order and their results are concatenated before deduplication.
Parameters:
Name Type Description
data Uint8Array
mimeType string
Source:
Returns:
Type
Array<!shaka.extern.MetadataFrame>

registerParserByMime(mimeType, parserFactory)

Registers a metadata parser factory for a given MIME type. The same MIME type may be registered more than once; each additional call appends the factory to the list of parsers for that MIME type. When shaka.metadata.Metadata.getMetadataFrames is called, all registered parsers for the MIME type are invoked in registration order and their frames are merged (with first-occurrence-wins deduplication on {@code key}).
Parameters:
Name Type Description
mimeType string
parserFactory shaka.extern.MetadataParser.Factory
Source:

supports(mimeType) → {boolean}

Returns {@code true} when at least one parser has been registered for {@code mimeType}.
Parameters:
Name Type Description
mimeType string
Source:
Returns:
Type
boolean

unregisterParserByMime(mimeType)

Unregisters all parser factories that have been registered for the given MIME type.
Parameters:
Name Type Description
mimeType string
Source: