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

FEC-14226: protect against missing textTracks in fast entry change #800

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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
Loading