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, ): ActiveMediaPlayer

ActiveMediaPlayer constructor

Parameters


Instance Methods

realize()

Generates the objects that will play media

playNow(_setBx?: module:boxes/ActiveBox.ActiveBox)

Plays the media, realizing it if needed.

Parameters

play(setBx?: module:boxes/ActiveBox.ActiveBox)

Plays the media when available, without blocking the current thread.

Parameters

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 in AUDIO_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 in AUDIO_BUFFERS

checkVisualComponentBounds( _bxi: module:boxes/ActiveBox.ActiveBox, )

Checks the position of visual components after a displacement or resizing of its container

Parameters

setVisualComponentVisible(_state: boolean)

Sets the visual component of this player visible or invisible

Parameters

  • _state (boolean) — true for visible

linkTo(setBx: module:boxes/ActiveBox.ActiveBox)

Sets the ActiveBox associated to this media player

Parameters

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.