media/ActiveMediaPlayer. ActiveMediaPlayer

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, mb, ps)

ActiveMediaPlayer constructor

Parameters:
NameTypeDescription
mcmodule:media/MediaContent.MediaContent
  • The content used by this player
mbmodule:bags/MediaBag.MediaBag

The project's MediaBag

psmodule:JClicPlayer.JClicPlayer

An object implementing the
PlayStation interface,
usually a JClicPlayer.

Members

$visualComponent :external:jQuery

The visual component for videos, usually a video HTML element

bx :module:boxes/ActiveBox.ActiveBox

MediaPlayers should be linked to ActiveBox objects.

mbe :module:bags/MediaBagElement.MediaBagElement

The module:bads/MediaBagElement.MediaBagElement containing the reference to the media to be played

mc :module:media/MediaContent.MediaContent

The MediaContent associated to this player.

ps :module:JClicPlayer.JClicPlayer

The player to which this player belongs.

useAudioBuffer :boolean

When true, this player makes use of a recording audio buffer

Type:
  • boolean

(static) 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.

Type:
  • Array.<external:AudioBuffer>

(static) 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

Type:
  • Boolean

Methods

checkVisualComponentBounds(_bxi)

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

Parameters:
NameTypeDescription
_bximodule:boxes/ActiveBox.ActiveBox

The container where this player is hosted

clear()

Frees all resources used by this player

clearAllAudioBuffers()

Clears all audio buffers

clearAudioBuffer(buffer)

Clears the specified audio buffer

Parameters:
NameTypeDescription
buffernumber

Index of the buffer in AUDIO_BUFFERS

countActiveBuffers() → {number}

Counts the number of active audio buffers

Returns:
Type: 
number

linkTo(setBx)

Sets the ActiveBox associated to this media player

Parameters:
NameTypeDescription
setBxmodule:boxes/ActiveBox.ActiveBox

The new container of this media. Can be null.

play(setBxopt)

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

Parameters:
NameTypeAttributesDescription
setBxmodule:boxes/ActiveBox.ActiveBox<optional>

The active box where this media will be placed (when video)

playNow(_setBxopt)

Plays the media, realizing it if needed.

Parameters:
NameTypeAttributesDescription
_setBxmodule:boxes/ActiveBox.ActiveBox<optional>

The active box where this media will be placed (when video)

realize()

Generates the objects that will play media

setVisualComponentVisible(_state)

Sets the visual component of this player visible or invisible

Parameters:
NameTypeDescription
_stateboolean

true for visible

stop()

Stops the media playing

stopAllAudioBuffers()

Stops the playing or recording actions of all audio buffers

stopAudioBuffer(buffer)

Stops a specific audio buffer

Parameters:
NameTypeDescription
buffernumber

Index of the buffer in AUDIO_BUFFERS