Fullscreen API methods (Fixes #74), onSetup callback

This commit is contained in:
Sam Potts
2015-04-06 11:47:23 +10:00
parent 2f4c56176d
commit 5322f4c62f
9 changed files with 123 additions and 73 deletions

2
docs/dist/docs.js vendored

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Docs styles -->
<link rel="stylesheet" href="//cdn.plyr.io/1.1.1/docs.css">
<link rel="stylesheet" href="//cdn.plyr.io/1.1.2/docs.css">
</head>
<body>
<main>

View File

@ -8,10 +8,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Styles -->
<link rel="stylesheet" href="//cdn.plyr.io/1.1.1/plyr.css">
<link rel="stylesheet" href="//cdn.plyr.io/1.1.2/plyr.css">
<!-- Docs styles -->
<link rel="stylesheet" href="//cdn.plyr.io/1.1.1/docs.css">
<link rel="stylesheet" href="//cdn.plyr.io/1.1.2/docs.css">
</head>
<body>
<header>
@ -83,13 +83,13 @@
b.insertBefore(c, b.childNodes[0]);
}
}
})(document, "https://cdn.plyr.io/1.1.1/sprite.svg");
})(document, "https://cdn.plyr.io/1.1.2/sprite.svg");
</script>
<!-- Plyr core script -->
<script src="//cdn.plyr.io/1.1.1/plyr.js"></script>
<script src="//cdn.plyr.io/1.1.2/plyr.js"></script>
<!-- Docs script -->
<script src="//cdn.plyr.io/1.1.1/docs.js"></script>
<script src="//cdn.plyr.io/1.1.2/docs.js"></script>
</body>
</html>

View File

@ -11,9 +11,21 @@ plyr.setup({
html: templates.controls.render({}),
captions: {
defaultActive: true
},
onSetup: function() {
var player = this,
type = player.media.tagName.toLowerCase(),
toggle = document.querySelector("[data-toggle='fullscreen']");
console.log("✓ Setup done for <" + type + ">");
if(type === "video" && toggle) {
toggle.addEventListener("click", player.toggleFullscreen, false);
}
}
});
// Google analytics
// For demo site (http://[www.]plyr.io) only
if(document.domain.indexOf("plyr.io") > -1) {