ActiveMediaPlayer
Source: ActiveMediaPlayer.js:39
This kind of object encapsulates a realized module:media/MediaContent.MediaContent and provides methods to start,
stop, pause and record different types of media (audio, video, MIDI, voice recording...)
Constructor
new ActiveMediaPlayer(
mc: module:media/MediaContent.MediaContent,
mb: module:bags/MediaBag.MediaBag,
ps: module:JClicPlayer.JClicPlayer,
): ActiveMediaPlayerActiveMediaPlayer constructor
Parameters
mc(module:media/MediaContent.MediaContent)mb(module:bags/MediaBag.MediaBag) — The project's MediaBagps(module:JClicPlayer.JClicPlayer) — An object implementing the
PlayStation interface,
usually a JClicPlayer.
Instance Methods
realize()
Generates the objects that will play media
playNow(_setBx?: module:boxes/ActiveBox.ActiveBox)
Plays the media, realizing it if needed.
Parameters
_setBx(module:boxes/ActiveBox.ActiveBox, optional) — The active box where this media will be placed (when video)
play(setBx?: module:boxes/ActiveBox.ActiveBox)
Plays the media when available, without blocking the current thread.
Parameters
setBx(module:boxes/ActiveBox.ActiveBox, optional) — The active box where this media will be placed (when video)
stop()
Stops the media playing
clear()
Frees all resources used by this player
clearAudioBuffer(buffer: number)
Clears the specified audio buffer
Parameters
buffer(number) — Index of the buffer inAUDIO_BUFFERS
clearAllAudioBuffers()
Clears all audio buffers
countActiveBuffers(): number
Counts the number of active audio buffers
Returns
number
stopAllAudioBuffers()
Stops the playing or recording actions of all audio buffers
stopAudioBuffer(buffer: number)
Stops a specific audio buffer
Parameters
buffer(number) — Index of the buffer inAUDIO_BUFFERS
checkVisualComponentBounds(
_bxi: module:boxes/ActiveBox.ActiveBox,
)
Checks the position of visual components after a displacement or resizing of its container
Parameters
_bxi(module:boxes/ActiveBox.ActiveBox) — The container where this player is hosted
setVisualComponentVisible(_state: boolean)
Sets the visual component of this player visible or invisible
Parameters
_state(boolean) —truefor visible
linkTo(setBx: module:boxes/ActiveBox.ActiveBox)
Sets the ActiveBox associated to this media player
Parameters
setBx(module:boxes/ActiveBox.ActiveBox) — The new container of this media. Can benull.
Instance Fields
mc: module:media/MediaContent.MediaContent
The MediaContent associated to this player.
ps: module:JClicPlayer.JClicPlayer
The player to which this player belongs.
bx: module:boxes/ActiveBox.ActiveBox
MediaPlayers should be linked to ActiveBox objects.
$visualComponent: external:jQuery
The visual component for videos, usually a video HTML element
useAudioBuffer: boolean
When true, this player makes use of a recording audio buffer
mbe: module:bags/MediaBagElement.MediaBagElement
The module:bads/MediaBagElement.MediaBagElement containing the reference to the media to be played
Static Fields
REC_ENABLED: Boolean
Recording of audio is enabled only when navigator.getUserMedia and MediaRecorder are defined
In 02-Mar-2016 this is implemented only in Firefox 41 and Chrome 49 or later.
See: https://addpipe.com/blog/mediarecorder-api
AUDIO_BUFFERS: Array.<external:AudioBuffer>
Audio buffers used for recording and playing voice are stored in a static array because
they are common to all instances of ActiveMediaPlayer
Only initialized when REC_ENABLED is true.