-
Notifications
You must be signed in to change notification settings - Fork 185
Asset Class Reference
The AV.Asset
class is responsible for managing all aspects of the decoding pipeline from source to decoder. You can use the AV.Asset
class to inspect information about an audio file, such as its format, metadata, and duration, as well as actually decode the file to raw linear PCM audio data.
Creates an AV.Asset
with the specified AV.Source.
Creates an AV.Asset
with an AV.HTTPSource
pointing to the specified url.
Creates an AV.Asset
with a AV.FileSource
pointing to the specified File.
Creates an AV.Asset
with an AV.BufferSource
created from the specified buffer. buffer
can be an AV.Buffer, an ArrayBuffer
, a typed array, a Node Buffer
, or even an AV.BufferList for decoding sequences of buffers.
The percentage of the audio file that has been buffered by the source
.
The duration of the audio file in milliseconds.
The format object describing the audio format as returned by the demuxer
.
An object containing any metadata embedded in the audio file.
A boolean indicating whether the decoding pipeline is currently active.
The backing AV.Source object for the asset.
The backing AV.Demuxer object for the asset, or null if demuxing hasn't started yet.
The backing AV.Decoder object for the asset, or null if decoding hasn't started yet.
Starts the decoding process of the asset.
Pauses the decoding process of the asset.
Used for inspecting various parts of an audio file without actually decoding the entire file. event
is allowed to be either 'format', 'duration', or 'metadata'. If the requested property has already been decoded at the time get
is called, the callback is invoked immediately. Otherwise, the asset waits until the requested event is emitted, at which point the callback is called and decoding is stopped.
Decodes the entire file and calls callback
with a single Float32Array
containing the decoded samples. It is preferrable to use the streaming decoding APIs (e.g. data events), so use this as a last resort when using such a streaming API is impossible.
Emitted while the audio file is being loaded with a percentage between 0 and 100 representing the amount of the file that has been read so far.
Emitted when the demuxer has decoded enough information to determine basic format information about the audio file.
Emitted when the duration of the audio file has been parsed.
Emitted when any embedded metadata is decoded.
Emitted when decoding of the actual audio data begins.
Emitted when audio data is decoded. buffer
is a Float32Array containing decoded Linear PCM audio. The data emitted by this event is always a Float32Array
; if you need the original data as returned by the decoder, use the decoder's data
event.
Emitted when the an error is encountered in the decoding process. Whenever an error is encountered, the decoding process is also stopped automatically.