Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
clappr with playlist
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>clappr</title>
<script src="http://cdn.clappr.io/latest/clappr.min.js"></script>
</head>
<body>
<div id="player"></div>
<script>
var playlist = [
'http://clappr.io/highline.mp4',
'http://vjs.zencdn.net/v/oceans.mp4',
'http://d11.cdnvideo.ru/videojs/files/hypnofrog.mp4',
'http://d11.cdnvideo.ru/videojs/files/m1080.mp4'
];
var player = new Clappr.Player({
source: playlist.shift(),
parentId: "#player",
autoPlay: true,
hideMediaControl: false,
});
// fired when player ends the video
player.on(Clappr.Events.PLAYER_ENDED, function () {
if (playlist.length > 0) {
player.load(playlist.shift());
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment