libcast/html5player-client

Libcast HTML5 Player JavaScript Client

v2.0.0 2016-12-19 09:19 UTC

This package is auto-updated.

Last update: 2024-11-29 04:41:21 UTC


README

Installation and use

The script build/libcast_player_client.min.js must be included either inside the <head> document part, or at the end of the HTML page, just before the closing </body> tag.

Then you must instanciate one LibcastPlayer object per embed:

var player = new LibcastPlayer('player_id');

See tests/single_embed.html for a complete example of how to use this client.

After client instantiation, Libcast embeds should behave like the standard HTML5 MediaElement API (see https://developer.mozilla.org/en/docs/Web/API/HTMLMediaElement).

Available player methods

The following list of methods is available from embed <iframe> elements once the Libcast client has been instantiated.

  • play()
  • pause()
  • toggle() [*]
  • seek(seconds) [*] where seconds must be an integer or a float
  • chapter(number) [*] where number must be an integer
  • mute() [*]
  • setVolume(level) [**] where level must be a float between 0 and 1 (percentage)

(* non HTML5 MediaElement API standard)

(** a bit different from the HTML5 MediaElement API standard because of JavaScript limitations)

Available player attributes

The following list of attributes is available from embed <iframe> elements once the Libcast client has been instantiated.

  • volume
  • duration
  • currentTime

Available player events

The following list of events is emitted by embed <iframe> elements once the Libcast client has been instantiated.

  • loadedmetadata
  • loadeddata
  • canplay
  • play
  • playing
  • pause
  • timeupdate
  • volumechange
  • ended

Compile source

  1. Install npm (Node) on your machine

  2. Install grunt

    npm install -g grunt-cli
    
  3. Install npm dependencies

    npm install
    
  4. Build source

    grunt
    

This should compile source under the /build directory.