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
## 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
- 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",
"version": "1.5.16",
"version": "1.5.17",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "http://plyr.io",
"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.
**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)
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:
```html
<link rel="stylesheet" href="https://cdn.plyr.io/1.5.16/plyr.css">
<script src="https://cdn.plyr.io/1.5.16/plyr.js"></script>
<link rel="stylesheet" href="https://cdn.plyr.io/1.5.17/plyr.css">
<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
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:
```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>
```

View File

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