Player Class
Constructor
Player
()
Example:
// Creates an instance:
var player = new Clappr.Player({source: "http://your.video/here.mp4", parentId: "#player"});
Item Index
Methods
Methods
attachTo
-
element
attach player to element
Parameters:
-
element
ObjectData 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
ObjectData options to build a player instance
-
[width]
Number optionalplayer's width
-
[height]
Number optionalplayer's height
-
[autoPlay]
Boolean optionalautomatically play after page load
-
[loop]
Boolean optionalautomatically replay after it ends
-
[chromeless]
Boolean optionalplayer acts in chromeless mode
-
[muted]
Boolean optionalstart the video muted
-
[persistConfig]
Boolean optionalpersist player's settings (volume) default:
true
-
[preload]
String optionalvideo will be preloaded according to
preload
attribute options default:'metadata'
-
[maxBufferLength]
Number optionalthe 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 optionalenable Google Analytics events dispatch (play/pause/stop/buffering/etc) by adding your
gaAccount
-
[gaTrackerName]
String optionalbesides
gaAccount
you can optionally, pass your favorite trackerName asgaTrackerName
-
[poster]
String optionaldefine 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