API Docs for: 0.2.41
Show:

Loader Class

It keeps a list of the default plugins (playback, container, core) and it merges external plugins with its internals.

Constructor

Loader

()

Methods

addExternalPlugins

(
  • plugins
)
private

adds all the external plugins that were passed through options.plugins

Parameters:

  • plugins Object

    the config object with all plugins

addExternalPlugins

(
  • an
)
Object private

groups by type the external plugins that were passed through options.plugins it they're on a flat array

Parameters:

  • an Object

    config object or an array of plugins

Returns:

Object:

plugins the config object with the plugins separated by type

constructor

(
  • externalPlugins
  • playerId
)

Inherited from BaseObject but overwritten in src/components/loader/loader.js:42

builds the loader

Parameters:

  • externalPlugins Object

    the external plugins

  • playerId Number

    you can embed multiple instances of clappr, therefore this is the unique id of each one.

listenTo

(
  • obj
  • name
  • callback
  • context
)

Inherited from Events: src/base/events.js:167

listen to an event indefinitely for a given obj

Parameters:

Example:

this.listenTo(this.core.playback, Events.PLAYBACK_PAUSE, this.callback)

listenToOnce

(
  • obj
  • name
  • callback
  • context
)

Inherited from Events: src/base/events.js:179

listen to an event once for a given obj

Parameters:

Example:

this.listenToOnce(this.core.playback, Events.PLAYBACK_PAUSE, this.callback)

off

(
  • name
  • callback
  • context
)

Inherited from Events: src/base/events.js:86

stop listening to an event

Parameters:

on

(
  • name
  • callback
  • context
)

Inherited from Events: src/base/events.js:53

listen to an event indefinitely, if you want to stop you need to call off

Parameters:

once

(
  • name
  • callback
  • context
)

Inherited from Events: src/base/events.js:68

listen to an event only once

Parameters:

stopListening

(
  • obj
  • name
  • callback
)

Inherited from Events: src/base/events.js:144

stop listening an event for a given object

Parameters:

trigger

(
  • name
)

Inherited from Events: src/base/events.js:122

triggers an event given its name

Parameters:

validateExternalPluginsType

(
  • plugins
)
private

validate if the external plugins that were passed through options.plugins are associated to the correct type

Parameters:

  • plugins Object

    the config object with all plugins

Properties

options

Object

returns the object options

uniqueId

String

a unique id prefixed with 'o', o1, o232

Events

CONTAINER_BITRATE

Inherited from Events: src/base/events.js:507

Fired when the container updates its bitrate

Event Payload:

  • bitrate Object

    Data bitrate object

    • [bandwidth] Number optional

      bitrate bandwidth when it's available

    • [width] Number optional

      playback width (ex: 720, 640, 1080)

    • [height] Number optional

      playback height (ex: 240, 480, 720)

    • [level] Number optional

      playback level when it's available, it could be just a map for width (0 => 240, 1 => 480, 2 => 720)

CONTAINER_HIGHDEFINITIONUPDATE

Inherited from Events: src/base/events.js:606

Fired when container updates its video quality

Event Payload:

  • isHD true Boolean

    when is on HD, false otherwise

CONTAINER_LOADEDMETADATA

Inherited from Events: src/base/events.js:532

Fired when the container loaded its metadata

Event Payload:

  • metadata Object

    Data settings object

    • [duration] Number optional

      the playback duration

    • [data] Object optional

      extra meta data

CONTAINER_MEDIACONTROL_HIDE

Inherited from Events: src/base/events.js:621

Fired when the media control hides

CONTAINER_MEDIACONTROL_SHOW

Inherited from Events: src/base/events.js:615

Fired when the media control shows

CONTAINER_OPTIONS_CHANGE

Inherited from Events: src/base/events.js:631

Fired when the options were changed for the container

CONTAINER_PLAYBACKSTATE

Inherited from Events: src/base/events.js:496

Fired when the container internal state changes

Event Payload:

  • state Object

    Data state object

    • [type] String optional

      the playback type

CONTAINER_PROGRESS

Inherited from Events: src/base/events.js:556

Fired when the container is downloading the media

Event Payload:

  • progress Object

    Data progress object

    • [start] Number optional

      initial downloaded content

    • [current] Number optional

      current dowloaded content

    • [total] Number optional

      total content to be downloaded

CONTAINER_READY

Inherited from Events: src/base/events.js:525

Fired when the container is ready

CONTAINER_SEEK

Inherited from Events: src/base/events.js:579

Fired when the container seeks the video

Event Payload:

  • time Number

    the current time in seconds

CONTAINER_SETTINGSUPDATE

Inherited from Events: src/base/events.js:600

Fired when the container changes any settings (volume, seek and etc)

CONTAINER_STATE_BUFFERFULL

Inherited from Events: src/base/events.js:594

Fired when the container filled the buffer

CONTAINER_STATE_BUFFERING

Inherited from Events: src/base/events.js:588

Fired when container is buffering

CONTAINER_TIMEUPDATE

Inherited from Events: src/base/events.js:544

Fired when the time is updated on container

Event Payload:

  • progress Object

    Data progress object

    • [current] Number optional

      current time

    • [total] Number optional

      total time

CORE_OPTIONS_CHANGE

Inherited from Events: src/base/events.js:475

Fired when the options were changed for the core

CORE_READY

Inherited from Events but overwritten in src/base/events.js:481

Fired after creating containers, when the core is ready

MEDIACONTROL_CONTAINERCHANGED

Inherited from Events: src/base/events.js:686

Fired when the container was changed

MEDIACONTROL_FULLSCREEN

Inherited from Events: src/base/events.js:640

Fired when the player enters/exit on fullscreen

MEDIACONTROL_HIDE

Inherited from Events: src/base/events.js:652

Fired when the media control hides

MEDIACONTROL_MOUSELEAVE_SEEKBAR

Inherited from Events: src/base/events.js:666

Fired when mouse leaves the seekbar

Event Payload:

  • event the Object

    javascript event

MEDIACONTROL_MOUSEMOVE_SEEKBAR

Inherited from Events: src/base/events.js:658

Fired when mouse enters on the seekbar

Event Payload:

  • event the Object

    javascript event

MEDIACONTROL_NOTPLAYING

Inherited from Events: src/base/events.js:680

Fired when the media is not being played

MEDIACONTROL_PLAYING

Inherited from Events: src/base/events.js:674

Fired when the media is being played

MEDIACONTROL_SHOW

Inherited from Events: src/base/events.js:646

Fired when the media control shows

PLAYBACK_BITRATE

Inherited from Events: src/base/events.js:363

Fired when playback updates its bitrate

Event Payload:

  • bitrate Object

    Data bitrate object

    • [bandwidth] Number optional

      bitrate bandwidth when it's available

    • [width] Number optional

      playback width (ex: 720, 640, 1080)

    • [height] Number optional

      playback height (ex: 240, 480, 720)

    • [level] Number optional

      playback level when it's available, it could be just a map for width (0 => 240, 1 => 480, 2 => 720)

PLAYBACK_BUFFERFULL

Inherited from Events: src/base/events.js:326

Fired when the playback has enough in the buffer to be able to play smoothly, after previously being unable to do this.

This corresponds to the playback buffering property being false.

PLAYBACK_BUFFERING

Inherited from Events: src/base/events.js:316

Fired when the playback starts having to buffer because playback can currently not be smooth.

This corresponds to the playback buffering property being true.

PLAYBACK_DVR

Inherited from Events: src/base/events.js:414

Fired when DVR becomes enabled/disabled.

Event Payload:

  • state Boolean

    true if dvr enabled

PLAYBACK_ENDED

Inherited from Events: src/base/events.js:425

Fired when the media for a playback ends.

Event Payload:

  • name String

    the name of the playback

PLAYBACK_ERROR

Inherited from Events: src/base/events.js:460

Fired if an error occurs in the playback.

Event Payload:

  • error Object

    An object containing the error details

  • name String

    Playback name

PLAYBACK_HIGHDEFINITIONUPDATE

Inherited from Events: src/base/events.js:355

Fired when playback updates its video quality

Event Payload:

  • isHD true Boolean

    when is on HD, false otherwise

PLAYBACK_LEVEL_SWITCH_END

Inherited from Events: src/base/events.js:396

Fired when the playback ends the level switch

PLAYBACK_LEVEL_SWITCH_START

Inherited from Events: src/base/events.js:389

Fired when the playback starts to switch level

PLAYBACK_LEVELS_AVAILABLE

Inherited from Events: src/base/events.js:379

Fired when the playback has its levels

Event Payload:

  • levels the Array

    ordered levels, each one with the following format {id: 1, label: '500kbps'} ps: id should be a number >= 0

  • initial the Number

    initial level otherwise -1 (AUTO)

PLAYBACK_LOADEDMETADATA

Inherited from Events: src/base/events.js:343

Fired when playback loaded its metadata

Event Payload:

  • metadata Object

    Data settings object

    • [duration] Number optional

      the playback duration

    • [data] Object optional

      extra meta data

PLAYBACK_PAUSE

Inherited from Events: src/base/events.js:448

Fired when the media for a playback pauses.

PLAYBACK_PLAY

Inherited from Events: src/base/events.js:438

Fired when the media for a playback starts playing. This is not necessarily when the user requests play() The media may have to buffer first. I.e. isPlaying() might return true before this event is fired, because isPlaying() represents the intended state.

PLAYBACK_PLAY_INTENT

Inherited from Events: src/base/events.js:432

Fired when user requests play()

PLAYBACK_PLAYBACKSTATE

Inherited from Events: src/base/events.js:404

Fired when playback internal state changes

Event Payload:

  • state Object

    Data state object

    • [type] String optional

      the playback type

PLAYBACK_PROGRESS

Inherited from Events: src/base/events.js:284

Fired when the playback is downloading the media

Event Payload:

  • progress Object

    Data progress object

    • [start] Number optional

      initial downloaded content

    • [current] Number optional

      current dowloaded content

    • [total] Number optional

      total content to be downloaded

PLAYBACK_READY

Inherited from Events: src/base/events.js:310

Fired when playback is ready

PLAYBACK_SETTINGSUPDATE

Inherited from Events: src/base/events.js:337

Fired when playback changes any settings (volume, seek and etc)

PLAYBACK_STOP

Inherited from Events: src/base/events.js:454

Fired when the media for a playback is stopped.

PLAYBACK_TIMEUPDATE

Inherited from Events: src/base/events.js:298

Fired when the time is updated on playback

Event Payload:

  • progress Object

    Data progress object

    • [current] Number optional

      current time

    • [total] Number optional

      total time

PLAYER_ENDED

Inherited from Events: src/base/events.js:243

Fired when player ends the video

PLAYER_ERROR

Inherited from Events: src/base/events.js:256

Fired when player receives an error

Event Payload:

PLAYER_FULLSCREEN

Inherited from Events: src/base/events.js:218

Fired when player changes its fullscreen state

Event Payload:

  • whether Boolean

    or not the player is on fullscreen mode

PLAYER_PAUSE

Inherited from Events: src/base/events.js:231

Fired when player pauses

PLAYER_PLAY

Inherited from Events: src/base/events.js:225

Fired when player starts to play

PLAYER_READY

Inherited from Events: src/base/events.js:205

Fired when the player is ready on startup

PLAYER_RESIZE

Inherited from Events: src/base/events.js:211

Fired when player resizes

Event Payload:

  • currentSize Object

    an object with the current size

PLAYER_SEEK

Inherited from Events: src/base/events.js:249

Fired when player seeks the video

Event Payload:

  • time Number

    the current time in seconds

PLAYER_STOP

Inherited from Events: src/base/events.js:237

Fired when player stops

PLAYER_TIMEUPDATE

Inherited from Events: src/base/events.js:263

Fired when the time is updated on player

Event Payload:

  • progress Object

    Data progress object

    • [current] Number optional

      current time

    • [total] Number optional

      total time

PLAYER_VOLUMEUPDATE

Inherited from Events: src/base/events.js:275

Fired when player updates its volume

Event Payload:

  • volume Number

    the current volume