Skip to content

Commit

Permalink
FEC-14226: protect against missing textTracks in fast entry change (#800
Browse files Browse the repository at this point in the history
)

### Description of the Changes

Please add a detailed description of the change, whether it's an
enhancement or a bugfix.
If the PR is related to an open issue please link to it.

### CheckLists

- [x] changes have been done against master branch, and PR does not
conflict
- [-] new unit / functional tests have been added (whenever applicable)
- [x] test are passing in local environment
- [x] Travis tests are passing (or test results are not worse than on
master branch :))
- [-] Docs have been updated
  • Loading branch information
MosheMaorKaltura authored Dec 5, 2024
1 parent 208df11 commit a524539
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,7 @@ export default class Player extends FakeEventTarget {
* @private
*/
private _getTracksByType<T extends PKTextTrack | AudioTrack | VideoTrack | ImageTrack>(type: { new (...args: any[]): T }): T[] {
return this._tracks.reduce((arr: T[], track) => {
return this._tracks?.reduce((arr: T[], track) => {
if (track instanceof type && track.available) {
arr.push(track);
}
Expand Down
2 changes: 1 addition & 1 deletion src/track/external-captions-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ class ExternalCaptionsHandler extends FakeEventTarget {
* @private
*/
private _maybeSetExternalCueIndex(): boolean {
const textTrack = this._player._getTextTracks().find(track => track.active && track.external);
const textTrack = this._player._getTextTracks()?.find(track => track.active && track.external);
if (textTrack && textTrack.external) {
const cues = this._textTrackModel[textTrack.language] ? this._textTrackModel[textTrack.language].cues : [];
let i = 0;
Expand Down

0 comments on commit a524539

Please sign in to comment.