Fix for multiple YouTube instances (Fixes #114)

This commit is contained in:
Sam Potts 2015-09-13 09:56:59 +10:00
parent e964c1a298
commit 66969f1a65
7 changed files with 26 additions and 15 deletions

2
dist/plyr.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"> <meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Docs styles --> <!-- Docs styles -->
<link rel="stylesheet" href="//cdn.plyr.io/1.3.5/docs.css"> <link rel="stylesheet" href="//cdn.plyr.io/1.3.6/docs.css">
</head> </head>
<body> <body>
<main> <main>

View File

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

BIN
docs/poster.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

View File

@ -1,6 +1,6 @@
{ {
"name": "plyr", "name": "plyr",
"version": "1.3.5", "version": "1.3.6",
"description": "A simple HTML5 media player using custom controls", "description": "A simple HTML5 media player using custom controls",
"homepage": "http://plyr.io", "homepage": "http://plyr.io",
"main": "gulpfile.js", "main": "gulpfile.js",

View File

@ -40,7 +40,7 @@ If you have any cool ideas or features, please let me know by [creating an issue
Check `docs/index.html` and `docs/dist/docs.js` for an example setup. Check `docs/index.html` and `docs/dist/docs.js` for an example setup.
**Heads up**, the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.3.5/plyr.js` to `https://cdn.plyr.io/1.3.5/plyr.js` **Heads up**, the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.3.6/plyr.js` to `https://cdn.plyr.io/1.3.6/plyr.js`
### Bower ### Bower
If bower is your thang, you can grab Plyr using: If bower is your thang, you can grab Plyr using:
@ -60,11 +60,11 @@ More info is on [npm](https://www.npmjs.com/package/ember-cli-plyr) and [GitHub]
If you want to use our CDN, you can use the following: If you want to use our CDN, you can use the following:
```html ```html
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.5/plyr.css"> <link rel="stylesheet" href="https://cdn.plyr.io/1.3.6/plyr.css">
<script src="https://cdn.plyr.io/1.3.5/plyr.js"></script> <script src="https://cdn.plyr.io/1.3.6/plyr.js"></script>
``` ```
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.3.5/sprite.svg`. You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.3.6/sprite.svg`.
### CSS ### CSS
If you want to use the default css, add the `plyr.css` file from /dist into your head, or even better use `plyr.less` or `plyr.sass` file included in `/src` in your build to save a request. If you want to use the default css, add the `plyr.css` file from /dist into your head, or even better use `plyr.less` or `plyr.sass` file included in `/src` in your build to save a request.

View File

@ -1,6 +1,6 @@
// ========================================================================== // ==========================================================================
// Plyr // Plyr
// plyr.js v1.3.5 // plyr.js v1.3.6
// https://github.com/selz/plyr // https://github.com/selz/plyr
// License: The MIT License (MIT) // License: The MIT License (MIT)
// ========================================================================== // ==========================================================================
@ -12,7 +12,7 @@
/*global YT*/ /*global YT*/
// Globals // Globals
var fullscreen, config; var fullscreen, config, callbacks = { youtube: [] };
// Default config // Default config
var defaults = { var defaults = {
@ -903,8 +903,19 @@
// Load the API // Load the API
_injectScript('https://www.youtube.com/iframe_api'); _injectScript('https://www.youtube.com/iframe_api');
// Add callback to queue
callbacks.youtube.push(function() { _YTReady(id, container); });
// Setup callback for the API // Setup callback for the API
window.onYouTubeIframeAPIReady = function () { _YTReady(id, container); }; window.onYouTubeIframeAPIReady = function () {
for (var i = callbacks.youtube.length - 1; i >= 0; i--) {
// Fire callback
callbacks.youtube[i]();
// Remove from queue
callbacks.youtube.splice(i, 1);
}
};
} }
} }