Skip to content

Commit 2073bdf

Browse files
committed
If track doesn't have a kind attribute, Able Player won't generate a transcript.
1 parent 8750db6 commit 2073bdf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/assets/js/media.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,27 @@ if ( ableplayer.settings.replace_audio === 'true' ) {
77
}
88
if ( 0 !== ableplayer_selectors.length ) {
99
const mediaEls = document.querySelectorAll( ableplayer_selectors );
10+
let childTracks;
1011
if ( mediaEls ) {
1112
mediaEls.forEach((el,index,listObj) => {
1213
let excludeClass = ableplayer.settings.exclude_class;
1314
if ( excludeClass !== '' && el.classList.contains( excludeClass ) || el.closest( 'figure' ).classList.contains( excludeClass ) ) {
1415
el.classList.add( 'ableplayer-skipped' );
1516
} else {
1617
el.removeAttribute( 'controls' );
17-
1818
if ( ! el.hasAttribute( 'data-able-player' ) ) {
1919
el.setAttribute( 'data-able-player', 'true' );
2020
}
2121
if ( ! el.hasAttribute( 'id' ) ) {
2222
el.setAttribute( 'id', 'able-player-id-' + index );
2323
}
2424
}
25+
childTracks = el.querySelectorAll( 'track' );
26+
childTracks.forEach((track,index,listObj) => {
27+
if ( ! track.hasAttribute( 'kind' ) ) {
28+
track.setAttribute( 'kind', 'subtitles' );
29+
}
30+
});
2531
});
2632
}
2733
}

0 commit comments

Comments
 (0)