Audio player

Caution

The following API is for Freebox’ internal use only. No guarantee is made on the stability of this API.

component fbx.media.AudioPlayer

An audio player is a mid-level object for audio playback. It provides menus for user interaction.

method urlOpen(url, properties)
Parameters
  • url (string) – Resource URL to open

  • properties (object) – Properties to pass to multimedia subsystem on opening.

Opens the stream for audio playback.

method close()

Closes the stream, release the player handle.

method stop()

Stops media playback, rewind position

method play()

Play media from current position

method pause()

Pause the media playback at the current position

method playPause()

Alternate between play and pause.

method seek(position, unit, whence)
Parameters
  • position (int) – Position to seek to

  • unit (int) – Unit to seek in (defaults to milliseconds)

  • whence (int) – Position to seek from (defaults to offset from start)

Seek in the stream

property mediaState

Current media state string. This reflects the current stream state in the player. Can have one of the following values:

none

No stream is currently opened in the player

loading

Stream is loading, not ready for playback

ready

Stream is ready for playback

ended

Stream ended after successful playback

property playbackState

Current media playback state string. This reflects the current player rendering status. Can have one of the following values:

stop

No playback currently occurs

pause

Playback is currently paused

play

Playback in progress

signal error(error, fatal)
Parameters
  • error (string) – Error name

  • fatal (bool) – Whether error is fatal for playback continuation

property parentalRating

Minimal age the stream requires. GUI must react to changes in this value.

property parentalLock

Whether parental lock is done. Must be set to false when parental control unlocks the stream.

property url

Stream URL. Setting this to "" stop all playback.

property autoplay

Whether playback should automatically start when URL changes.

property subtitleUrl

URL for an optional external subtitle stream. This subtitle stream will be added to internal subtitles streams.

property audioRole

A string from the following enumeration, representing the most suitable role for the audio stream.

  • video

  • music

  • game

  • event

  • unknown

This property will notably trigger enabling the AVL processing on the Freebox Devialet speaker when the audio role is not set to music.

property videoList

A ListModel of all Video streams available. Properties of items in this list are:

uid

Stream UID, internal use only

codec

Stream codec

width

Stream image width

height

Stream image height

dar

Stream image display aspect ratio

framerate

Stream image rate

bitrate

Stream compressed bitrate

pid

Stream PID (for TS, internal use only)

property audioList

A ListModel of all Audio streams available. Properties of items in this list are:

uid

Stream UID, internal use only

codec

Stream codec

channelCount

Count of channels in stream

samplerate

Stream sample rate

language

ISO code for stream language

bitrate

Stream compressed bitrate

pid

Stream PID (for TS, internal use only)

property subtitleList

A ListModel of all Subtitle streams available. Properties of items in this list are:

uid

Stream UID, internal use only

codec

Stream codec

type

Subtitle stream type

language

ISO code for stream language

pid

Stream PID (for TS, internal use only)

property currentVideoIndex

Video stream index (wrt videoList) currently played back. Use -1 for no video stream.

property currentAudioIndex

Audio stream index (wrt audioList) currently played back. Use -1 for no audio stream.

property currentSubtitleIndex

Subtitle stream index (wrt subtitleList) currently played back. Use -1 for no subtitle stream.

signal videoListUpdated()

Fired when videoList changes

signal audioListUpdated()

Fired when audioList changes

signal subtitleListUpdated()

Fired when subtitleList changes

property metadata

A javascript object containing all metadata for the stream. Expected keys are:

container

Media container format

author

Track author

comment

File comment

copyright

Track copyright

date

Production date (as an unix timestamp)

genre

Genre (string)

title

Track title

url

URL in metadata (not the stream URL)

album

Album name

albumArtist

Artist name for album

artist

Artist name

bpm

Beats per minute (int)

compilation

Whether disc is a compilation (bool)

composer

Composer name

discNumber

Disc number in collection

discTotal

Total count of discs in collection

performer

Performer name

trackNumber

Count of tracks in disc

trackTotal

Total count of tracs on disc

discId

Disc identifier

musicbrainzDiscId

Musicbrainz disc ID

property position

Current position, in milliseconds.

property duration

Total stream duration, in milliseconds

property streamMenu

A fbx.ui.menu.Menu for stream selection. User should make this menu accessible through its own fbx.ui.menu.View.

property volume

Stream volume. This is not intended for user interaction. User may use global volume mixer through its remote control.

property mute

Whether to mute audio stream. This is not intended for user interaction. User may use global volume mixer through its remote control.

signal ended()

Fired when stream ends.

signal encrypted(initDataType, initData)

Fired when initialization data is encountered in the media. For example a list of ISO Media PSSH boxes. The first argument is a string named initDataType and the only currently supported value is “cenc”. The second argument initData is an ArrayBuffer containing PSSH boxes. Those 2 parameters shouldn’t be touched and must be used as is to call the Cdm method mediaKeySession.generateRequest();

property mediaKeys

A reference to the javascript mediaKeys object previously created with the Cdm method keySystemAccess.createMediaKeys().

method setMediaKeys(mediaKeys)

An helper method to set the mediaKeys property of the Video Player.