Skip to content

Commit

Permalink
fix(FEC-7380, FEC-7381): there are captions displayed when the captio…
Browse files Browse the repository at this point in the history
…ns are supposed to be 'off' (#157)


If the lang comparer receives an empty string as the input lang, it should always returns false (startsWith method will always return true for empty string...)
  • Loading branch information
Dan Ziv authored and OrenMe committed Nov 6, 2017
1 parent 776bdb0 commit 4b52b80
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ export default class Player extends FakeEventTarget {
* @private
*/
_repositionCuesTimeout: any;

/**
* @param {Object} config - The configuration for the player instance.
* @constructor
Expand Down
2 changes: 1 addition & 1 deletion src/track/track.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class Track {
try {
inputLang = inputLang.toLowerCase();
trackLang = trackLang.toLowerCase();
return inputLang.startsWith(trackLang) || trackLang.startsWith(inputLang);
return inputLang ? (inputLang.startsWith(trackLang) || trackLang.startsWith(inputLang)) : false;
} catch (e) {
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions test/src/track/track.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ describe('Track', () => {
Track.langComparer('es', 'ita').should.be.false;
Track.langComparer('ita', 'es').should.be.false;
});

it('should return false if the input lang is empty', () => {
Track.langComparer('', 'rus').should.be.false;
});
});
});

0 comments on commit 4b52b80

Please sign in to comment.