Skip to content

Commit

Permalink
Fix a bug with texttrack selection if only forced subtitles are prese…
Browse files Browse the repository at this point in the history
…nt (#4556)
  • Loading branch information
dsilhavy authored Aug 23, 2024
1 parent d8284f8 commit 97c553b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/streaming/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ function Stream(config) {
const mediaInfo = streamProcessors[i].getMediaInfo();
if (type === Constants.AUDIO ||
type === Constants.VIDEO ||
(type === Constants.TEXT && mediaInfo.isFragmented)) {
(type === Constants.TEXT && mediaInfo && mediaInfo.isFragmented)) {
let mediaInfo = streamProcessors[i].getMediaInfo();
if (mediaInfo) {
protectionController.initializeForMedia(mediaInfo);
Expand Down
5 changes: 4 additions & 1 deletion src/streaming/controllers/MediaController.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,9 @@ function MediaController() {
}

function _handleInitialTextTrackSelection(mediaInfos) {
if (!mediaInfos || mediaInfos.length === 0) {
return null;
}
const filteredMediaInfos = mediaInfos.filter((mediaInfo) => {
if (mediaInfo && mediaInfo.roles && mediaInfo.roles.length > 0) {
return mediaInfo.roles.every((role) => {
Expand All @@ -665,7 +668,7 @@ function MediaController() {
return filteredMediaInfos[0];
}

return null
return mediaInfos[0];
}

/**
Expand Down

0 comments on commit 97c553b

Please sign in to comment.