Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FEC-11697): 2 captions are selected in the menu #182

Merged
merged 9 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
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 @@ -990,21 +990,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 @@ -472,10 +472,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