Fix for voiceover

This commit is contained in:
Sam Potts 2015-08-08 21:01:06 +10:00
parent 7a23dda294
commit f700d50dc8
7 changed files with 27 additions and 17 deletions

View File

@ -1,5 +1,8 @@
# Changelog
# v1.3.2
- Voiceover fix for captions
# v1.3.1
- ARIA improvements for captions being read

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">
<!-- Docs styles -->
<link rel="stylesheet" href="//cdn.plyr.io/1.3.1/docs.css">
<link rel="stylesheet" href="//cdn.plyr.io/1.3.2/docs.css">
</head>
<body>
<main>

View File

@ -8,10 +8,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Styles -->
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.1/plyr.css?3">
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.2/plyr.css?3">
<!-- Docs styles -->
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.1/docs.css?1">
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.2/docs.css?1">
</head>
<body>
<header>
@ -48,7 +48,7 @@
<source src="https://cdn.selz.com/plyr/1.0/movie.webm" type="video/webm">
<!-- Text track file -->
<track kind="captions" label="English" srclang="en" src="https://cdn.selz.com/plyr/1.0/en.vtt" default>
<track kind="captions" label="English" srclang="en" src="https://cdn.selz.com/plyr/1.0/en.vtt?2" default>
<!-- Fallback for browsers that don't support the <video> element -->
<a href="https://cdn.selz.com/plyr/1.0/movie.mp4">Download</a>
@ -97,13 +97,13 @@
b.insertBefore(c, b.childNodes[0]);
}
}
})(document, "https://cdn.plyr.io/1.3.1/sprite.svg");
})(document, "https://cdn.plyr.io/1.3.2/sprite.svg");
</script>
<!-- Plyr core script -->
<script src="https://cdn.plyr.io/1.3.1/plyr.js?1"></script>
<script src="https://cdn.plyr.io/1.3.2/plyr.js?1"></script>
<!-- Docs script -->
<script src="https://cdn.plyr.io/1.3.1/docs.js?1"></script>
<script src="https://cdn.plyr.io/1.3.2/docs.js?1"></script>
</body>
</html>

View File

@ -1,6 +1,6 @@
{
"name": "plyr",
"version": "1.3.1",
"version": "1.3.2",
"description": "A simple HTML5 media player using custom controls",
"homepage": "http://plyr.io",
"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.
**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.1/plyr.js` to `https://cdn.plyr.io/1.3.1/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.2/plyr.js` to `https://cdn.plyr.io/1.3.2/plyr.js`
### Bower
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:
```html
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.1/plyr.css">
<script src="https://cdn.plyr.io/1.3.1/plyr.js"></script>
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.2/plyr.css">
<script src="https://cdn.plyr.io/1.3.2/plyr.js"></script>
```
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.3.1/sprite.svg`.
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.3.2/sprite.svg`.
### 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.

View File

@ -640,20 +640,27 @@
}
}
// Clear the caption
player.captionsContainer.innerHTML = "";
// Check if the next caption is in the current time range
if (player.media.currentTime.toFixed(1) >= _timecodeMin(player.captions[player.subcount][0]) &&
player.media.currentTime.toFixed(1) <= _timecodeMax(player.captions[player.subcount][0])) {
player.currentCaption = player.captions[player.subcount][1];
// Render the caption (only if changed)
// Trim caption text
var content = player.currentCaption.trim();
// Render the caption (only if changed)
if(player.captionsContainer.innerHTML != content) {
// Empty caption
// Otherwise NVDA reads it twice
player.captionsContainer.innerHTML = "";
// Set new caption text
player.captionsContainer.innerHTML = content;
}
}
else {
player.captionsContainer.innerHTML = "";
}
}
// Display captions container and button (for initialization)