Skip to content

Instantly share code, notes, and snippets.

@alihammad-gist
Created December 30, 2015 11:07
Show Gist options
  • Save alihammad-gist/b421d8d16520166982ba to your computer and use it in GitHub Desktop.
Save alihammad-gist/b421d8d16520166982ba to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Dm</title>
</head>
<body>
<h2>Hello</h2>
<div id="player-container"></div>
<script src="http://api.dmcdn.net/all.js"></script>
<script type="text/javascript">
DM.init({
apiKey: '6f5a0b377ee569d0978e',
status: true,
cookie: true
});
DM.api('/playlist/x48sus_cocomoo_onten-demo/videos', function (response) {
var videos = response.list;
var cursor = 0;
var player = DM.player(
document.getElementById('player-container'),
{
video: videos[cursor].id,
params:
{
autoplay: 1,
chromeless: 1
}
}
);
cursor = cursor + 1;
player.addEventListener('ended', function (e) {
if (cursor + 1 > videos.length) {
cursor = 0;
}
e.target.load(videos[cursor].id);
cursor += 1;
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment