Add the following scripts on your HTML:
<head>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/latest/underscore.js"> </script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/latest/jquery.js"> </script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/latest/clappr.min.js"> </script>
</head>
Now, create the player:
<body>
<div id="player"></div>
<script>
var playerEl = document.getElementById("player");
var player = new Clappr.Player({source: "http://your.video/here.mp4"});
player.attachTo(playerEl);
</script>
</body>
Format | IE10 | IE11 | Firefox | Chrome | Safari | iPhone | iPad | Android |
---|---|---|---|---|---|---|---|---|
HLS | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
MP4 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
MP3 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
DASH | ✖️ | ✖️ | ✖️ | ✖️ | ✖️ | ✖️ | ✖️ | ✖️ |
RTMP | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✖️ | ✖️ | ✖️ |
All parameters listed below shall be added on Clappr.Player
object instantiation. Example:
var player = new Clappr.Player({
source: "http://your.video/here.mp4",
parameter1: "value1",
parameter2: "value2",
});
You can set the player size setting width
and height
parameters.
Add autoPlay: true
if you want the video to automatic play after page load.
If you want to play the video automatically when player truly appears on screen, add autoPlayVisible: true
.
Customize control bar colors adding mediacontrol
hash. Example:
var player = new Clappr.Player({
source: "http://your.video/here.mp4",
mediacontrol: {seekbar: "#E113D3", buttons: "#66B2FF"}
});
Result:
I'm sure you can do better than me.
Put watermark: http://url/img.png
on your embed parameters to automatically add watermark on your video. Choose corner position by defining position parameter. Positions can be bottom-left
, bottom-right
, top-left
and top-right
. Example:
var player = new Clappr.Player({
source: "http://your.video/here.mp4",
watermark: "http://url/img.png", position: 'top-right'
});
Define a poster by adding poster: http://url/img.png
on your embed parameters. It will appear after video embed, disappear on play and go back when user stops the video.
Clappr has a native statistics plugin that accounts QoE metrics such playing time, rebuffering time, total rebuffers, etc. Metrics report happens periodically, learn how to access these numbers on Create your own plugin session.
Clappr is under heavy development but production-ready. Feel free to open issues and send us pull requests.
Clone the project and install gulp:
npm install -g gulp
Then enter the project directory and install the dependencies:
npm install
Make your changes and build your own version:
gulp build
Check the result on dist/
folder.
The culprits of this project are listed here.
In general, we follow the fork-and-pull git workflow:
- Fork the repository on GitHub
- Commit changes to a branch in your fork
- Pull request "upstream" with your changes
- Merge changes in to "upstream" repoository