Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
3602b95
Bump tar-fs from 3.0.9 to 3.1.1
dependabot[bot] Sep 24, 2025
1b510fc
Merge pull request #686 from ableplayer/dependabot/npm_and_yarn/tar-f…
joedolson Sep 26, 2025
45a54b1
Merge pull request #687 from ableplayer/develop
joedolson Sep 26, 2025
562b6b5
Merge pull request #688 from ableplayer/develop
joedolson Sep 28, 2025
2cb553f
#692 Parse timestamp tags in WebVTT
richard-smith-preservica Oct 16, 2025
48a8655
Setting max-width does not set width; need video to default to 100%
joedolson Oct 24, 2025
37b976b
Merge pull request #693 from richard-smith-preservica/timestamp-tags-…
joedolson Dec 20, 2025
1e8cb26
Hide transcript & description preferences if player does not have those
joedolson Dec 20, 2025
ca9dec7
Remove console.log
joedolson Dec 20, 2025
8db667f
Prevent descriptions from firing when media not playing
joedolson Dec 20, 2025
4f11091
Avoid repainting icons when unchanged
joedolson Dec 27, 2025
c3cd4b8
Add a new method to fetch translations, with support for fallback.
joedolson Dec 28, 2025
a29b72d
Apply big play on background and background color.
joedolson Dec 28, 2025
78948a2
Make Cookie.js an optional dependency, and use localStorage by default
joedolson Dec 28, 2025
1d14cbf
Remove screen reader only text from buttons
joedolson Dec 28, 2025
4be3ec9
Big play button shouldn't have border radius
joedolson Dec 28, 2025
a917047
Add mechanism to view translations in demos
joedolson Dec 28, 2025
3c2cac4
Remove JS sizing to define player width and height
joedolson Dec 28, 2025
33758cf
Make player type aria-label a translatable string
joedolson Dec 28, 2025
2586e95
Add support for an audio poster image.
joedolson Dec 28, 2025
e082170
Add poster image demo to index
joedolson Dec 28, 2025
fb48cbd
Invite people to contribute financially to Able Player
joedolson Dec 28, 2025
bbf5c65
Add support link to docs header.
joedolson Dec 28, 2025
c94be4a
Update funding info to be current.
joedolson Dec 28, 2025
1dc4515
Move API docs to a notes file in docs instead of JS files.
joedolson Dec 28, 2025
3437d38
Add docs about array elements in geticons
joedolson Dec 28, 2025
5f7b138
Add support for a fixed location for sign language video
joedolson Dec 28, 2025
dd8689d
Update package-lock.json
joedolson Dec 28, 2025
f63c909
Adjust caption styling to center.
joedolson Dec 28, 2025
b2582e2
Rename vars to reflect that they may not be cookies
joedolson Dec 29, 2025
a693ef9
More cookie var renaming
joedolson Dec 29, 2025
9e30126
Improve draggable window positioning
joedolson Dec 29, 2025
596c617
Replace $.ajax with fetch in tracks
joedolson Dec 29, 2025
0a2011c
Begin process of removing jQuery by supporting jQuery slim
joedolson Dec 29, 2025
fd00c08
Update fadeout/in to use CSS transitions
joedolson Dec 29, 2025
8e46268
Update comments to reflect change
joedolson Dec 29, 2025
ffef8fa
Change translations to fetch async await
joedolson Dec 29, 2025
eb816bb
Show needs to happen before hide, not simultaneous.
joedolson Dec 29, 2025
493c21f
Swap jQuery deferred to custom prototype
joedolson Dec 30, 2025
1678dd6
Update docs to reflect changed dependency & update demos to use the s…
joedolson Dec 30, 2025
2b33a4c
Missed file save in deferred changes
joedolson Dec 30, 2025
4d4f887
Eliminate some unused code
joedolson Dec 30, 2025
ac831d7
Merge pull request #709 from ableplayer/jquery-slim
joedolson Dec 30, 2025
fa3ae30
Replace jQuery getScript
joedolson Dec 30, 2025
4d3fd84
On Safari, YouTube automatic posters don't show. This is a known Safa…
joedolson Dec 30, 2025
b92a105
Merge pull request #711 from ableplayer/jquery-slim
joedolson Dec 30, 2025
9cee3c8
Remove some additional unused variables.
joedolson Dec 30, 2025
360b5eb
Merge branch 'develop' of https://github.com/ableplayer/ableplayer in…
joedolson Dec 30, 2025
61c9277
Function doesn't use the YouTube ID argument.
joedolson Dec 30, 2025
7c95772
Remove hide callbacks & change draggable to be a more explicit region.
joedolson Dec 30, 2025
d75d394
Design adjustments to resize and drag handles
joedolson Dec 30, 2025
35f3dd8
Unused var
joedolson Dec 30, 2025
f366acf
Set transcript language order; design adjustments.
joedolson Dec 30, 2025
8b6bcaa
Invalid value passed to getYouTubePosterUrl
joedolson Dec 31, 2025
edda545
All YouTube videos have 640, not all have hd.
joedolson Dec 31, 2025
661ccfb
Assign poster as background to bigplaybutton
joedolson Dec 31, 2025
b2641d2
Remove code that enables poster with YouTube player
joedolson Dec 31, 2025
0214f1f
Remove unused variable, minor changes to comments
joedolson Dec 31, 2025
4127407
Remove setFullscreen(false) when rebuilding player
joedolson Dec 31, 2025
c7c6d7f
Remove references to the helpDialog, which hasn't existed for at leas…
joedolson Dec 31, 2025
3847046
Add preference enabling users to disable custom keyboard shortcuts
joedolson Dec 31, 2025
de99c87
Set border-box sizing on chapters buttons
joedolson Dec 31, 2025
5157e44
Add setTimeout to resolve promise if no captions found.
joedolson Dec 31, 2025
3b5ef73
Simplify AccessibleDialog, remove fullscreen polyfill
joedolson Dec 31, 2025
cb17466
Adjust and restore sign and transcript windows for fullscreen
joedolson Dec 31, 2025
733e64f
Remove right margin on checkbox label in draggables
joedolson Jan 1, 2026
d6dc0c3
Update VTT parsing to handle cues as individual inputs.
joedolson Jan 9, 2026
7228330
Remove debugging
joedolson Jan 9, 2026
c71301c
Ensure that positioning $window doesn't happen if it isn't present.
joedolson Jan 9, 2026
31a2e37
Bump VTS notice to 10 seconds.
joedolson Jan 9, 2026
0d2cc31
Tweaks to VTS alert styles
joedolson Jan 10, 2026
fe8d4a8
Fix todo comment text
joedolson Jan 10, 2026
359ba86
Enhance translations by supporting variables in translated strings
joedolson Jan 10, 2026
efe82f5
Localize VTS
joedolson Jan 10, 2026
b54a833
Accidentally removed entire tr.
joedolson Jan 10, 2026
f77d5ee
Pass data.text where trackText used to be.
joedolson Jan 10, 2026
4849653
Update comment
joedolson Jan 10, 2026
8b37b9f
Add VTS translations to language files.
joedolson Jan 10, 2026
bee61bb
Some comment improvements
joedolson Jan 10, 2026
ebc1f30
Merge pull request #712 from ableplayer/develop
joedolson Jan 10, 2026
e6d24bd
Update video5.html
joedolson Jan 10, 2026
21cc20d
Styling fixes for search2
joedolson Jan 10, 2026
1d813f5
Text fix now that YouTube is supported without captions
joedolson Jan 10, 2026
39e9367
Commit build files
joedolson Jan 10, 2026
811f573
Merge pull request #716 from ableplayer/develop
joedolson Jan 10, 2026
a04fe82
Update changelog.md
joedolson Jan 10, 2026
802287a
Merge pull request #717 from ableplayer/develop
joedolson Jan 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add mechanism to view translations in demos
Requires a switch from array to object data for langs, to provide language names.
  • Loading branch information
joedolson committed Dec 28, 2025
commit a917047c53c0d426f6c2c8cc61e8673daa3a2a81
1 change: 1 addition & 0 deletions demos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ <h2>Other Demos</h2>
<li><a href="other-native.html">Native HTML5 Player</a> (not <em>Able Player</em>), for comparison</li>
<li><a href="other-noa11y.html">Able Player with no HTML tracks</a> (don't do this)</li>
<li><a href="other-vts.html">Able Player with Video Transcript Sorter (VTS)</a></li>
<li><a href="translations.html">Able Player Translations - view player in translation</a></li>
<li><a href="other-width.html">Able Player Width Tests</a></li>
<li><a href="other-fallback.html">Able Player Fallback Test Page</a></li>
</ul>
Expand Down
136 changes: 136 additions & 0 deletions demos/translations.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>View translations | Able Player Demos</title>
<link rel="stylesheet" href="demos.css" type="text/css">

<!-- Dependencies -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>

<!-- Able Player CSS -->
<link rel="stylesheet" href="../build/ableplayer.min.css" type="text/css"/>

<!-- Able Player JavaScript -->
<script src="../build/ableplayer.js"></script>

<!-- CSS for this example -->
<style>
#video-wrapper {
width: 500px;
}
.flex {
display: flex;
flex-wrap: wrap;
align-items: end;
margin-bottom: 1.5rem;
gap: 4px;
}
.flex p {
margin: 0;
padding: 0;
}
.flex select, .flex button {
padding: .33rem;
}
.notification p {
background: #ffc;
padding: .5rem;
}
</style>
<script>
$(document).ready(function() {
let player = new AblePlayer('#video1');
let media = document.querySelector( '#video1' );
let header = document.querySelector( 'header' );
let nav = document.querySelector( 'nav' );
let content = document.querySelector( '.content' );
let button = document.querySelector( '#select_lang' );
let translations = player.getSupportedLangs();
let select = document.querySelector( '#lang_selector' );
let html = document.querySelector( 'html' );
let notification = document.querySelector( '.notification' );
for( const [key,value] of Object.entries(translations) ) {
let option = document.createElement( 'option' );
option.setAttribute( 'value', key );
option.innerText = value;
select.insertAdjacentElement( 'beforeend', option );
};
button.addEventListener( 'click', function() {
let value = select.value;
let langName = select.options[select.selectedIndex].text;
if ( value === '' ) {
html.setAttribute( 'lang', 'en' );
header.removeAttribute( 'lang' );
nav.removeAttribute( 'lang' );
content.removeAttribute( 'lang' );
let wrapper = media.closest( '.able-wrapper' );
wrapper.replaceWith( player.media );
player = new AblePlayer( '#video1' );
} else {
html.setAttribute( 'lang', value );
header.setAttribute( 'lang', 'en' );
nav.setAttribute( 'lang', 'en' );
content.setAttribute( 'lang', 'en' );
let wrapper = media.closest( '.able-wrapper' );
wrapper.replaceWith( player.media );
player = new AblePlayer( '#video1' );
}
notification.innerHTML = '<p>Player refreshed in your selected language: <strong>' + langName + '</strong>.</p>';
})
});
</script>
</head>

<body>
<header>
<div class="title">Able Player Demos</div>
</header>
<nav>
<ul>
<li><a href="index.html">More demos</a></li>
<li><a href="https://ableplayer.github.io/ableplayer">Able Player Home</a></li>
</ul>
</nav>
<main>
<div class="content">
<h1>View translations</h1>

<p>Use this view to check translations of Able Player.</p>
<div class="flex">
<p>
<label for="lang_selector">Select language</label><br />
<select id="lang_selector">
<option value="">Default Language</option>
</select>
</p>
<button type="button" id="select_lang">Switch Language</button>
</div>
<div class="notification" role="alert">

</div>
</div>
<div id="video-wrapper">
<video id="video1" preload="auto" poster="../media/wwa.jpg" playsinline>
<source type="video/mp4" src="../media/wwa.mp4" data-desc-src="../media/wwa_described.mp4" data-youtube-sign-src="https://youtu.be/bf6214F7srY"/>
<track kind="captions" src="../media/wwa_captions_de.vtt" srclang="de" label="Deutsche"/>
<track kind="captions" src="../media/wwa_captions_en.vtt" srclang="en" label="English" default/>
<track kind="captions" src="../media/wwa_captions_es.vtt" srclang="es" label="Español"/>
<track kind="subtitles" src="../media/wwa_captions_fr.vtt" srclang="fr" label="Français"/>
<track kind="subtitles" src="../media/wwa_captions_ja.vtt" srclang="ja" lang="ja" label="日本語"/>
<track kind="descriptions" src="../media/wwa_description_de.vtt" srclang="de"/>
<track kind="descriptions" src="../media/wwa_description_en.vtt" srclang="en"/>
<track kind="descriptions" src="../media/wwa_description_es.vtt" srclang="es"/>
<track kind="descriptions" src="../media/wwa_description_fr.vtt" srclang="fr"/>
<track kind="descriptions" src="../media/wwa_description_ja.vtt" srclang="ja"/>
<track kind="chapters" src="../media/wwa_chapters_de.vtt" srclang="de"/>
<track kind="chapters" src="../media/wwa_chapters_en.vtt" srclang="en"/>
<track kind="chapters" src="../media/wwa_chapters_es.vtt" srclang="es"/>
<track kind="chapters" src="../media/wwa_chapters_fr.vtt" srclang="fr"/>
</video>
</div>

</main>
</body>
</html>
49 changes: 34 additions & 15 deletions scripts/translation.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
(function ($) {
AblePlayer.prototype.getSupportedLangs = function() {
// returns an array of languages for which AblePlayer has translation tables
var langs = ['ca','cs','da','de','en','es','fr','he','id','it','ja','ms','nb','nl','pl','pt','pt-br','sv','tr','zh-tw'];
var langs = {
'ca' : 'Catalan',
'cs' : 'Czech',
'da' : 'Danish',
'de' : 'German',
'en' : 'English',
'es' : 'Spanish',
'fr' : 'French',
'he' : 'Hebrew',
'id' : 'Indonesian',
'it' : 'Italian',
'ja' : 'Japanese',
'ms' : 'Malay',
'nb' : 'Norwegian Bokmål',
'nl' : 'Dutch',
'pl' : 'Polish',
'pt' : 'Portuguese',
'pt-br' : 'Brazilian Portuguese',
'sv' : 'Swedish',
'tr' : 'Turkish',
'zh-tw' : 'Chinese (Taiwan)'
};

return langs;
};

Expand All @@ -23,27 +45,25 @@
supportedLangs = this.getSupportedLangs(); // returns an array

if (this.lang) { // a data-lang attribute is included on the media element
if ($.inArray(this.lang,supportedLangs) === -1) {
if ( Object.hasOwn( supportedLangs,this.lang ) ) {
// the specified language is not supported
if (this.lang.indexOf('-') == 2) {
if ( this.lang.indexOf('-') == 2 ) {
// this is a localized lang attribute (e.g., fr-CA)
// try the parent language, given the first two characters
// if parent lang is supported. Use that, else null.
this.lang = ($.inArray(this.lang.substring(0,2),supportedLangs) !== -1) ? this.lang.substring(0,2) : null;
this.lang = ( Object.hasOwn(supportedLangs,this.lang.substring(0,2)) !== -1 ) ? this.lang.substring(0,2) : null;
} else {
// this is not a localized language.
// but maybe there's a similar localized language supported
// that has the same parent?
similarLangFound = false;
i = 0;
while (i < supportedLangs.length) {
if (supportedLangs[i].substring(0,2) == this.lang) {
for ( const [key,value] of Object.entries(supportedLangs) ) {
if ( key.substring(0,2) == this.lang ) {
this.lang = supportedLangs[i];
similarLangFound = true;
}
i++;
}
if (!similarLangFound) {
if ( !similarLangFound ) {
// language requested via data-lang is not supported
this.lang = null;
}
Expand All @@ -61,15 +81,15 @@
docLang = null;
}
if (docLang) {
if ($.inArray(docLang,supportedLangs) !== -1) {
if ( Object.hasOwn( supportedLangs,docLang ) ) {
// the document language is supported
this.lang = docLang;
} else {
// the document language is not supported
if (docLang.indexOf('-') == 2) {
// this is a localized lang attribute (e.g., fr-CA)
// try the parent language, given the first two characters
if ($.inArray(docLang.substring(0,2),supportedLangs) !== -1) {
if ( Object.hasOwn(supportedLangs,docLang.substring(0,2)) ) {
// the parent language is supported. use that.
this.lang = docLang.substring(0,2);
}
Expand Down Expand Up @@ -125,19 +145,18 @@
var thisObj, supportedLangs, i, thisLang, translationFile, thisText, translation;

supportedLangs = this.getSupportedLangs();

thisObj = this;

this.sampleText = [];
for (i=0; i < supportedLangs.length; i++) {
translationFile = this.rootPath + 'translations/' + supportedLangs[i] + '.json';
for ( const [key,value] of Object.entries(supportedLangs) ) {
translationFile = this.rootPath + 'translations/' + key + '.json';
$.getJSON(translationFile, thisLang, (function(thisLang) {
return function(data) {
thisText = data.sampleDescriptionText;
translation = {'lang':thisLang, 'text': thisText};
thisObj.sampleText.push(translation);
};
}(supportedLangs[i])) // pass lang to callback function
}(key)) // pass lang to callback function
);
}
}
Expand Down