ARIA improvements for caption reading
This commit is contained in:
parent
34c9bdc84c
commit
f3c324038f
@ -1,5 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
# v1.3.1
|
||||||
|
- ARIA improvements for captions being read
|
||||||
|
|
||||||
# v1.3.0
|
# v1.3.0
|
||||||
- Internationalization support (i18n) using default controls (required markup changes to controls)
|
- Internationalization support (i18n) using default controls (required markup changes to controls)
|
||||||
- ARIA enhancements for controls (required markup changes to controls)
|
- ARIA enhancements for controls (required markup changes to controls)
|
||||||
|
2
dist/plyr.js
vendored
2
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
@ -6,7 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<!-- Docs styles -->
|
<!-- Docs styles -->
|
||||||
<link rel="stylesheet" href="//cdn.plyr.io/1.3.0/docs.css">
|
<link rel="stylesheet" href="//cdn.plyr.io/1.3.1/docs.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<!-- Styles -->
|
<!-- Styles -->
|
||||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.0/plyr.css?3">
|
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.1/plyr.css?3">
|
||||||
|
|
||||||
<!-- Docs styles -->
|
<!-- Docs styles -->
|
||||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.0/docs.css?1">
|
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.1/docs.css?1">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
@ -97,13 +97,13 @@
|
|||||||
b.insertBefore(c, b.childNodes[0]);
|
b.insertBefore(c, b.childNodes[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})(document, "https://cdn.plyr.io/1.3.0/sprite.svg");
|
})(document, "https://cdn.plyr.io/1.3.1/sprite.svg");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Plyr core script -->
|
<!-- Plyr core script -->
|
||||||
<script src="https://cdn.plyr.io/1.3.0/plyr.js?1"></script>
|
<script src="https://cdn.plyr.io/1.3.1/plyr.js?1"></script>
|
||||||
|
|
||||||
<!-- Docs script -->
|
<!-- Docs script -->
|
||||||
<script src="https://cdn.plyr.io/1.3.0/docs.js?1"></script>
|
<script src="https://cdn.plyr.io/1.3.1/docs.js?1"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "plyr",
|
"name": "plyr",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"description": "A simple HTML5 media player using custom controls",
|
"description": "A simple HTML5 media player using custom controls",
|
||||||
"homepage": "http://plyr.io",
|
"homepage": "http://plyr.io",
|
||||||
"main": "gulpfile.js",
|
"main": "gulpfile.js",
|
||||||
|
@ -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.3.0/plyr.js` to `https://cdn.plyr.io/1.3.0/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.1/plyr.js` to `https://cdn.plyr.io/1.3.1/plyr.js`
|
||||||
|
|
||||||
### Bower
|
### Bower
|
||||||
If bower is your thang, you can grab Plyr using:
|
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:
|
If you want to use our CDN, you can use the following:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.0/plyr.css">
|
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.1/plyr.css">
|
||||||
<script src="https://cdn.plyr.io/1.3.0/plyr.js"></script>
|
<script src="https://cdn.plyr.io/1.3.1/plyr.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.3.0/sprite.svg`.
|
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.3.1/sprite.svg`.
|
||||||
|
|
||||||
### CSS
|
### 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.
|
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.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Plyr
|
// Plyr
|
||||||
// plyr.js v1.3.0
|
// plyr.js v1.3.1
|
||||||
// https://github.com/selz/plyr
|
// https://github.com/selz/plyr
|
||||||
// License: The MIT License (MIT)
|
// License: The MIT License (MIT)
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@ -640,17 +640,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear the caption
|
||||||
|
player.captionsContainer.innerHTML = "";
|
||||||
|
|
||||||
// Check if the next caption is in the current time range
|
// Check if the next caption is in the current time range
|
||||||
if (player.media.currentTime.toFixed(1) >= _timecodeMin(player.captions[player.subcount][0]) &&
|
if (player.media.currentTime.toFixed(1) >= _timecodeMin(player.captions[player.subcount][0]) &&
|
||||||
player.media.currentTime.toFixed(1) <= _timecodeMax(player.captions[player.subcount][0])) {
|
player.media.currentTime.toFixed(1) <= _timecodeMax(player.captions[player.subcount][0])) {
|
||||||
player.currentCaption = player.captions[player.subcount][1];
|
player.currentCaption = player.captions[player.subcount][1];
|
||||||
|
|
||||||
// Render the caption
|
// Render the caption (only if changed)
|
||||||
player.captionsContainer.innerHTML = player.currentCaption.trim();
|
var content = player.currentCaption.trim();
|
||||||
|
if(player.captionsContainer.innerHTML != content) {
|
||||||
|
player.captionsContainer.innerHTML = content;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// Clear the caption
|
|
||||||
player.captionsContainer.innerHTML = "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1019,7 +1021,7 @@
|
|||||||
function _setupCaptions() {
|
function _setupCaptions() {
|
||||||
if(player.type === "video") {
|
if(player.type === "video") {
|
||||||
// Inject the container
|
// Inject the container
|
||||||
player.videoContainer.insertAdjacentHTML("afterbegin", "<div class='" + config.selectors.captions.replace(".", "") + "' aria-live='assertive'><span></span></div>");
|
player.videoContainer.insertAdjacentHTML("afterbegin", "<div class='" + config.selectors.captions.replace(".", "") + "' aria-live='assertive' aria-relevant='additions text'><span></span></div>");
|
||||||
|
|
||||||
// Cache selector
|
// Cache selector
|
||||||
player.captionsContainer = _getElement(config.selectors.captions).querySelector("span");
|
player.captionsContainer = _getElement(config.selectors.captions).querySelector("span");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user