Skip to content

Commit

Permalink
Deferring youtube initialization (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
moay committed Sep 21, 2017
1 parent 0791c0c commit 257b0ee
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 11 deletions.
Empty file added .gitattributes
Empty file.
10 changes: 5 additions & 5 deletions dist/afterglow.min.js

Large diffs are not rendered by default.

Binary file modified dist/afterglow.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "afterglowplayer",
"description": "An easy to integrate HTML5 video player with lightbox support.",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
41 changes: 41 additions & 0 deletions sandbox/test_101.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<title>afterglow development sandbox</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.3">

<!-- STYLES -->
<link rel="stylesheet" type="text/css" href="../vendor/videojs/video-js.css">
<link rel="stylesheet/less" type="text/css" href="../src/less/skins/afterglow-default.less">
<link rel="stylesheet/less" type="text/css" href="../src/less/skins/afterglow-light.less">
<link rel="stylesheet/less" type="text/css" href="../src/less/skins/afterglow-dark.less">
<link rel="stylesheet/less" type="text/css" href="../src/less/components/lightbox.less">

<!-- SCRIPTS -->
<script src="js/less.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../vendor/videojs/video.js"></script>
<script type="text/javascript" src="../vendor/videojs/plugins/Youtube.js"></script>
<script type="text/javascript" src="../vendor/videojs/plugins/videojs-vimeo.js"></script>
<script type="text/javascript" src="../vendor/videojs/plugins/videojs.hotkeys.js"></script>
<script type="text/javascript" src="../dist/tmp/afterglow-bundle.js"></script>

<style>
body{
max-width:1000px;
margin: 0 auto;
padding:0 50px 50px;
}
</style>

</head>
<body>
<h1>This is just a sandbox for development.</h1>

<!-- LOCAL TEST -->
<h2>Local video, single source, with poster and bound play event</h2>
<a class="afterglow" href="#video1"> Test 2</a>
<video id="video1" width="1920" height="1080" poster="http://afterglowplayer.com/sandbox/video/Snapshots/afterglow_local.jpg" preload="none" data-youtube-id="HgbHx4CY300"></video>
<video id="video2" class="afterglow" width="1920" height="1080" poster="http://afterglowplayer.com/sandbox/video/Snapshots/afterglow_local.jpg" preload="none" src="http://afterglowplayer.com/sandbox/video/MP4/afterglow_local.mp4"></video>
</body>
</html>
9 changes: 4 additions & 5 deletions vendor/videojs/plugins/Youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ THE SOFTWARE. */
var Youtube = videojs.extend(Tech, {

constructor: function(options, ready) {
if (typeof document !== 'undefined'){
loadScript('https://www.youtube.com/iframe_api', apiLoaded);
injectCss();
}
Tech.call(this, options, ready);

this.setPoster(options.poster);
Expand Down Expand Up @@ -735,11 +739,6 @@ THE SOFTWARE. */

Youtube.apiReadyQueue = [];

if (typeof document !== 'undefined'){
loadScript('https://www.youtube.com/iframe_api', apiLoaded);
injectCss();
}

// Older versions of VJS5 doesn't have the registerTech function
if (typeof videojs.registerTech !== 'undefined') {
videojs.registerTech('Youtube', Youtube);
Expand Down

0 comments on commit 257b0ee

Please sign in to comment.