API Docs for: 0.2.38
Show:

Player Class

Extends BaseObject
Module: components

Constructor

Player

()

Example:

// Creates an instance:
var player = new Clappr.Player({source: "http://your.video/here.mp4", parentId: "#player"});

Item Index

Methods

attachTo

(
  • element
)

attach player to element

Parameters:

  • element Object

    Data You can use this method to attach the player to a given element. You don't need to do this when you specify it during the player instantiation passing the parentId param.

constructor

(
  • options
  • [options.mediacontrol] customize control bar colors, example: ```javascript var player = new Clappr.Player({ source: "http://your.video/here.mp4", mediacontrol: {seekbar: "#E113D3", buttons: "#66B2FF"} }); ``` Result: ![Clappr with modified media control colors]
)

Player's constructor

You must pass the options object to build the player.

var options = {source: "http://example.com/video.mp4", param1: "val1"};
var player = new Clappr.Player(options);

Parameters:

  • options Object

    Data options to build a player instance

    • [width] Number optional

      player's width

    • [height] Number optional

      player's height

    • [autoPlay] Boolean optional

      automatically play after page load

    • [loop] Boolean optional

      automatically replay after it ends

    • [chromeless] Boolean optional

      player acts in chromeless mode

    • [muted] Boolean optional

      start the video muted

    • [persistConfig] Boolean optional

      persist player's settings (volume) default: true

    • [preload] String optional

      video will be preloaded according to preload attribute options default: 'metadata'

    • [maxBufferLength] Number optional

      the default behavior for the HLS playback is to keep buffering indefinitely, even on VoD. This replicates the behavior for progressive download, which continues buffering when pausing the video, thus making the video available for playback even on slow networks. To change this behavior use maxBufferLength where value is in seconds.

    • [gaAccount] String optional

      enable Google Analytics events dispatch (play/pause/stop/buffering/etc) by adding your gaAccount

    • [gaTrackerName] String optional

      besides gaAccount you can optionally, pass your favorite trackerName as gaTrackerName

    • [poster] String optional

      define a poster by adding its address http://url/img.png. It will appear after video embed, disappear on play and go back when user stops the video.

  • [options.mediacontrol] customize control bar colors, example: ```javascript var player = new Clappr.Player({ source: "http://your.video/here.mp4", mediacontrol: {seekbar: "#E113D3", buttons: "#66B2FF"} }); ``` Result: ![Clappr with modified media control colors] Object