Cancel requests on source change (Fixes #174)
This commit is contained in:
parent
1bbc47c64f
commit
cd83a2670b
18
changelog.md
18
changelog.md
@ -1,5 +1,23 @@
|
||||
# Changelog
|
||||
|
||||
## v1.5.16
|
||||
- Cancel requests on source change (Fixes #174)
|
||||
|
||||
## v1.5.15
|
||||
- Fix for CustomEvent polyfill and related bug (See #172)
|
||||
|
||||
## v1.5.14
|
||||
- Volume storage fix (Fixes #171)
|
||||
|
||||
## v1.5.13
|
||||
- Fix for manual caption rendering
|
||||
|
||||
## v1.5.12
|
||||
- Added a duration option to pass the duration of the file
|
||||
- Added the ability to set options per element by setting a data-plyr attribute on the target elements (this might be useful for the duration option for example)
|
||||
- Fixes for Chrome and Safari caption rendering, they now use the default texttrack and cuechange events
|
||||
- Firefox bug fix for event not defined
|
||||
|
||||
## v1.5.11
|
||||
- iOS embed bug fixes (fixes #166)
|
||||
- Hide IE/Edge <input type='range'> tooltip (since we have a styled one) (fixes #160)
|
||||
|
4
dist/plyr.js
vendored
4
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "plyr",
|
||||
"version": "1.5.15",
|
||||
"version": "1.5.16",
|
||||
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
|
||||
"homepage": "http://plyr.io",
|
||||
"main": "src/js/plyr.js",
|
||||
|
10
readme.md
10
readme.md
@ -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.15/plyr.js` to `https://cdn.plyr.io/1.5.15/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.16/plyr.js` to `https://cdn.plyr.io/1.5.16/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.15/plyr.css">
|
||||
<script src="https://cdn.plyr.io/1.5.15/plyr.js"></script>
|
||||
<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>
|
||||
```
|
||||
|
||||
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.15/sprite.svg`.
|
||||
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.16/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.15/plyr.js"></script>
|
||||
<script src="https://cdn.plyr.io/1.5.16/plyr.js"></script>
|
||||
<script>plyr.setup();</script>
|
||||
```
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// ==========================================================================
|
||||
// Plyr
|
||||
// plyr.js v1.5.15
|
||||
// plyr.js v1.5.16
|
||||
// https://github.com/selz/plyr
|
||||
// License: The MIT License (MIT)
|
||||
// ==========================================================================
|
||||
@ -2225,6 +2225,9 @@
|
||||
_remove(plyr.videoContainer);
|
||||
}
|
||||
|
||||
// Cancel current network requests
|
||||
_cancelRequests();
|
||||
|
||||
// Remove the old media
|
||||
_remove(plyr.media);
|
||||
|
||||
@ -2521,6 +2524,31 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Cancel current network requests
|
||||
// See https://github.com/Selz/plyr/issues/174
|
||||
function _cancelRequests() {
|
||||
if(!_inArray(config.types.html5, plyr.type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set empty src attribute
|
||||
plyr.media.setAttribute('src', '');
|
||||
|
||||
// Remove child sources
|
||||
var sources = plyr.media.querySelectorAll('source');
|
||||
for (var i = 0; i < sources.length; i++) {
|
||||
_remove(sources[i]);
|
||||
}
|
||||
|
||||
// Load the new empty source
|
||||
// This will cancel existing requests
|
||||
// See https://github.com/Selz/plyr/issues/174
|
||||
plyr.media.load();
|
||||
|
||||
// Debugging
|
||||
_log("Cancelled network requests for old media");
|
||||
}
|
||||
|
||||
// Destroy an instance
|
||||
// Event listeners are removed when elements are removed
|
||||
// http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory
|
||||
@ -2547,7 +2575,7 @@
|
||||
|
||||
// If video, we need to remove some more
|
||||
if (plyr.type === 'video') {
|
||||
// Remove captions
|
||||
// Remove captions container
|
||||
_remove(_getElement(config.selectors.captions));
|
||||
|
||||
// Remove video wrapper
|
||||
|
Loading…
x
Reference in New Issue
Block a user