Skip to content

Instantly share code, notes, and snippets.

@yorkfx
Created May 8, 2020 17:40
Show Gist options
  • Save yorkfx/e20afef18632b0bd887357a128bfa97d to your computer and use it in GitHub Desktop.
Save yorkfx/e20afef18632b0bd887357a128bfa97d to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://player.vimeo.com/api/player.js"></script>
<form id="form1" runat="server">
<div>
<%--<iframe id="player1" src="https://player.vimeo.com/video/76979871?api=1&player_id=player1" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>--%>
<iframe id="player1" src="https://player.vimeo.com/video/76979871?api=1" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<%--<iframe width="560" height="315" src="//player.vimeo.com/video/5705212?api=1&player_id=video1" id="video1"></iframe>--%>
<iframe width="560" height="315" src="//player.vimeo.com/video/5705212?api=1" id="video1"></iframe>
</div>
<script>
$(document).ready(function () {
var x = document.querySelectorAll("iframe");
var nodelist = x.length;
alert(nodelist);
for (i = 0; i < nodelist; i++) {
var player = new Vimeo.Player(x[i]);
player.on('play', function () {
console.log('played the video!');
});
player.on('ended', function () {
console.log('ended the video!');
});
player.on('finish', function () {
console.log('finished the video!');
player.getDuration().then(function (duration) {
// duration = the duration of the video in seconds
console.log('video length is:', duration);
}).catch(function (error) {
// an error occurred
});
});
player.on('playProgress', function () {
console.log('Video in progress!');
});
//player.getVideoTitle().then(function (title) {
// console.log('title:', title);
//});
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment