Skip to content

Commit

Permalink
fix(FEC-11697): 2 captions are selected in the menu (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanTGold committed Sep 7, 2022
1 parent 9acfe47 commit 9964cf0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"pushTaggedRelease": "git push --follow-tags --no-verify origin master",
"release": "standard-version",
"test": "NODE_ENV=test karma start --color --mode development",
"test:watch": "NODE_ENV=test karma start --browsers=Chrome --single-run=false --auto-watch",
"watch": "webpack --progress --colors --watch --mode development"
},
"husky": {
Expand Down
25 changes: 11 additions & 14 deletions src/dash-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1030,21 +1030,18 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
* @private
*/
_getParsedTextTracks(): Array<TextTrack> {
let textTracks = this._shaka.getTextTracks();
let parsedTracks = [];
if (textTracks) {
for (let i = 0; i < textTracks.length; i++) {
let kind = textTracks[i].kind ? textTracks[i].kind + 's' : '';
kind = kind === '' && this._config.useShakaTextTrackDisplay ? 'captions' : kind;
let settings = {
kind: kind,
active: false,
label: textTracks[i].label,
language: textTracks[i].language,
index: i
};
parsedTracks.push(new TextTrack(settings));
}
for (const textTrack of this._shaka.getTextTracks()) {
let kind = textTrack.kind ? textTrack.kind + 's' : '';
kind = kind === '' && this._config.useShakaTextTrackDisplay ? 'captions' : kind;
let settings = {
id: textTrack.id,
kind: kind,
active: false,
label: textTrack.label,
language: textTrack.language
};
parsedTracks.push(new TextTrack(settings));
}
return parsedTracks;
}
Expand Down
6 changes: 3 additions & 3 deletions test/src/dash-adapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,10 @@ describe('DashAdapter: _getParsedTracks', () => {
(track.label === audioTracks[track.index].label).should.be.true;
}
if (track instanceof TextTrack) {
track.kind.should.equal(textTracks[track.index].kind + 's');
const dashTrack = textTracks.find(textTrack => textTrack.id === track.id && textTrack.label === track.label);
track.kind.should.equal(dashTrack.kind + 's');
track.active.should.be.false;
track.language.should.equal(textTracks[track.index].language);
(track.label === textTracks[track.index].label).should.be.true;
track.language.should.equal(dashTrack.language);
}
});
done();
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -854,9 +854,9 @@
integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==

"@playkit-js/playkit-js@canary":
version "0.77.0-canary.7812357"
resolved "https://registry.yarnpkg.com/@playkit-js/playkit-js/-/playkit-js-0.77.0-canary.7812357.tgz#1e9c9edaba2f17faa86c3ab7d9057be0857e6e07"
integrity sha512-19xK5Ro2aBFIsKFg78PNK0PXVhWWqRBsAieGGm2jRmcOSvkp6l34DfyWxpTK5ZRWG1aHu2C7i0CNslLCBHtZ0Q==
version "0.78.1-canary.bf28e11"
resolved "https://registry.yarnpkg.com/@playkit-js/playkit-js/-/playkit-js-0.78.1-canary.bf28e11.tgz#3e8e3d2be59729781fad6db90574310047516605"
integrity sha512-tLGBBS80gVh5DLpYNCfBStFaEvmS50Mk/3emU9sY65HjJkhueq1sj3Nj1UM2x1tksc77Q6NSNLX/DFUtsqpNdg==
dependencies:
js-logger "^1.6.0"
ua-parser-js "1.0.2"
Expand Down

0 comments on commit 9964cf0

Please sign in to comment.