Bug fixes and native APIs exposed for embeds

This commit is contained in:
Sam Potts 2016-03-07 22:28:30 +11:00
parent cd83a2670b
commit 87d174ac2c
5 changed files with 27 additions and 15 deletions

View File

@ -1,5 +1,10 @@
# Changelog # Changelog
## v1.5.17
- Expose YouTube and Vimeo API (docs update required) (Fixes #176)
- Auto set title based on YouTube getVideoData() title property
- Bug fix for Vimeo API change (Uncaught TypeError: Cannot read property 'value' of undefined) due to a change their end
## v1.5.16 ## v1.5.16
- Cancel requests on source change (Fixes #174) - Cancel requests on source change (Fixes #174)

4
dist/plyr.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "plyr", "name": "plyr",
"version": "1.5.16", "version": "1.5.17",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player", "description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "http://plyr.io", "homepage": "http://plyr.io",
"main": "src/js/plyr.js", "main": "src/js/plyr.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.5.16/plyr.js` to `https://cdn.plyr.io/1.5.16/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.5.17/plyr.js` to `https://cdn.plyr.io/1.5.17/plyr.js`
### Node Package Manager (NPM) ### Node Package Manager (NPM)
Using NPM, you can grab Plyr: Using NPM, you can grab Plyr:
@ -69,11 +69,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.5.16/plyr.css"> <link rel="stylesheet" href="https://cdn.plyr.io/1.5.17/plyr.css">
<script src="https://cdn.plyr.io/1.5.16/plyr.js"></script> <script src="https://cdn.plyr.io/1.5.17/plyr.js"></script>
``` ```
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.16/sprite.svg`. You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.17/sprite.svg`.
### CSS & Styling ### CSS & Styling
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.
@ -175,7 +175,7 @@ Be sure to [validate your caption files](https://quuz.org/webvtt/)
Here's an example of a default setup: Here's an example of a default setup:
```html ```html
<script src="https://cdn.plyr.io/1.5.16/plyr.js"></script> <script src="https://cdn.plyr.io/1.5.17/plyr.js"></script>
<script>plyr.setup();</script> <script>plyr.setup();</script>
``` ```

View File

@ -1,6 +1,6 @@
// ========================================================================== // ==========================================================================
// Plyr // Plyr
// plyr.js v1.5.16 // plyr.js v1.5.17
// https://github.com/selz/plyr // https://github.com/selz/plyr
// License: The MIT License (MIT) // License: The MIT License (MIT)
// ========================================================================== // ==========================================================================
@ -133,7 +133,7 @@
// URLs // URLs
urls: { urls: {
vimeo: { vimeo: {
api: 'https://cdn.plyr.io/froogaloop/1.0.0/plyr.froogaloop.js', api: 'https://cdn.plyr.io/froogaloop/1.0.1/plyr.froogaloop.js',
}, },
youtube: { youtube: {
api: 'https://www.youtube.com/iframe_api' api: 'https://www.youtube.com/iframe_api'
@ -1420,6 +1420,9 @@
// Set title // Set title
_setTitle(_getElement('iframe')); _setTitle(_getElement('iframe'));
// Store reference to API
plyr.container.plyr.embed = plyr.embed;
} }
// Handle YouTube API ready // Handle YouTube API ready
@ -1470,6 +1473,9 @@
plyr.media.currentTime = instance.getCurrentTime(); plyr.media.currentTime = instance.getCurrentTime();
plyr.media.muted = instance.isMuted(); plyr.media.muted = instance.isMuted();
// Set title
config.title = instance.getVideoData().title;
// Trigger timeupdate // Trigger timeupdate
_triggerEvent(plyr.media, 'timeupdate'); _triggerEvent(plyr.media, 'timeupdate');
@ -2225,6 +2231,9 @@
_remove(plyr.videoContainer); _remove(plyr.videoContainer);
} }
// Remove embed object
plyr.embed = null;
// Cancel current network requests // Cancel current network requests
_cancelRequests(); _cancelRequests();
@ -2326,12 +2335,10 @@
} }
// Set aria title and iframe title // Set aria title and iframe title
if ('title' in source) {
config.title = source.title; config.title = source.title;
_setTitle(); _setTitle();
}
// Reset media object // Reset media objects
plyr.container.plyr.media = plyr.media; plyr.container.plyr.media = plyr.media;
} }