Fix for manual captions
This commit is contained in:
parent
5b968c97f4
commit
c99f20d5d8
2
dist/plyr.js
vendored
2
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "plyr",
|
"name": "plyr",
|
||||||
"version": "1.5.12",
|
"version": "1.5.13",
|
||||||
"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",
|
||||||
|
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.
|
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.12/plyr.js` to `https://cdn.plyr.io/1.5.12/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.13/plyr.js` to `https://cdn.plyr.io/1.5.13/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.12/plyr.css">
|
<link rel="stylesheet" href="https://cdn.plyr.io/1.5.13/plyr.css">
|
||||||
<script src="https://cdn.plyr.io/1.5.12/plyr.js"></script>
|
<script src="https://cdn.plyr.io/1.5.13/plyr.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.12/sprite.svg`.
|
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.13/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.
|
||||||
@ -170,7 +170,7 @@ More info on CORS here:
|
|||||||
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.12/plyr.js"></script>
|
<script src="https://cdn.plyr.io/1.5.13/plyr.js"></script>
|
||||||
<script>plyr.setup();</script>
|
<script>plyr.setup();</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -914,16 +914,26 @@
|
|||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr.readyState === 4) {
|
||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
var records = [],
|
var captions = [],
|
||||||
record,
|
caption,
|
||||||
req = xhr.responseText;
|
req = xhr.responseText;
|
||||||
|
|
||||||
records = req.split('\n\n');
|
captions = req.split('\n\n');
|
||||||
|
|
||||||
for (var r = 0; r < records.length; r++) {
|
for (var r = 0; r < captions.length; r++) {
|
||||||
record = records[r];
|
caption = captions[r];
|
||||||
plyr.captions[r] = [];
|
plyr.captions[r] = [];
|
||||||
plyr.captions[r] = record.split('\n');
|
|
||||||
|
// Get the parts of the captions
|
||||||
|
var parts = caption.split('\n'),
|
||||||
|
index = 0;
|
||||||
|
|
||||||
|
// Incase caption numbers are added
|
||||||
|
if(parts[index].indexOf(":") === -1) {
|
||||||
|
index = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
plyr.captions[r] = [parts[index], parts[index + 1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove first element ('VTT')
|
// Remove first element ('VTT')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user