The media element to act upon
A reference to the audio node, if set. Allows finer control over the media.
The unique id
The overall volume of the output. Can be used to control the output volume in addition to fadings. (Default: 1, representing 0 dBFS)
The playback rate. (Default: 1, representing normal speed)
Whether the media data had loaded enough to start playback.
Private _faderThe uniqe id
Private _looperPrivate _mediaThe {HTMLMediaElement} instance to act upon
Private _omitWhether to omit the fade-in operation on the next, subsequent play operation
This automatically gets reset at next play operation or any seek operation. It can only be set when the media is not currently playing.
Private _pitchPrivate _playbackWhether the media data has loaded (at least enough to start playback)
This implies that metadata also has been loaded already
see HAVE_CURRENT_DATA at https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState#examples
Whether the media metadata has loaded. Duration is available now.
see HAVE_METADATA at https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState#examples
Flags, whether deferred loading (until a user play click event is handled) is required to further load the track media file data. The flag may be set once after the metadata was successfully loaded.
When true, handling of a subsequent play action must first invoke a user-triggered load operation. This specific handling is currently required on (some?) iOS devices, because they only load data upon explicit user interaction.
Private lastKeeper for the last emitted current time, to avoid multiple equal outputs.
Emits a changed current time position, in [seconds].
The change can stem fron ongoing playback and/or a seek or loop operation.
could be NaN or infinity, depending on the source
Emits a changed duration.
could be NaN or infinity, depending on the source
Occurs, when the end of the track has been reached and playback has ended.
This is not triggered when the track or a range of it is looping. Allows to select the next track in "play all" and "shuffle" mode.
Emits a changed next fade-in omission.
whether the next fade-in is omitted
Emits a changed playback state.
the playback state.
Emits an ocurred seek operation.
the target time of the seek operation
Emits a changed seeking state.
Seeking is a
whether the media is currently seeked (while playing or not)
Whether the media data had loaded enough to start playback.
This is a shorthand for (playbackState equal to playing or ready). A value of false indicates an a currently non-playable state.
Gets the current time position in [seconds].
currentTime - could be NaN or infinity, depending on the source
This is not necessarily the exact same value as was last emitted via {onCurrentTimeChanged}.
Gets the media duration, in [seconds].
Might be a non-finite number, if data is not (yet) available.
Gets the audio fading handler
Gets the id.
Gets or sets whether to loop this whole track.
This does not apply to compilation looping (looping over a set of tracks).
Gets or sets whether to loop this whole track.
This does not apply to compilation looping (looping over a set of tracks).
Gets the audio fading handler
Gets the media source URL.
Sets the media source URL.
Gets whether the next play operation omits the fade-in.
Gets the paused state.
During fading, the playback state is not considered as paused.
Gets the pitch shift controller
Gets the playback rate controller
Gets the playback state.
During fading, the playback state is not considered as paused.
Private handlePrivate handleStarts playback from the given temporal position
When set, omits the fade-in at playback start. Default is false.
This first seeks to the position, then starts playing (with a possible fade-in)
Private repeatPrivate resetSeeks to the given time position, if the media is loaded and the position is valid.
the temporal position, in [seconds], to seek to
optionally, whether the promise only resolves when the media can play, instead of already when the seek operation completed. Default is false, only to wait for the seek.
Promise - resolves when the seek operation completed.
Immediately also advertises the new temporal position
Private singlePrivate update
Implements a playback handler for a {HTMLMediaElement}.
Remarks
This handles transport/loop and volume operations for audio sources (HTML media elements). See https://github.com/suterma/replayer-pwa/tree/main/doc/media-handling#readme
Devdoc
Fading is handeled internally with it's own handler.