File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -410,9 +410,13 @@ const observer = new MutationObserver((mutations) => {
410410 const rect = playerNode . getBoundingClientRect ( ) ;
411411 if ( ( isEmbed || rect . x !== 0 || playerNode . id !== 'player' ) && rect . width * rect . height > 0 && ( ! FoundYTPlayer || FoundYTPlayerIdentifier !== identifier ) ) {
412412 // check if element contains the ytd-player element
413- const ytdPlayer = playerNode . querySelector ( 'ytd-player' ) ;
414- if ( ! ytdPlayer ) {
415- return false ;
413+
414+ // if not embed
415+ if ( ! isEmbed ) {
416+ const ytdPlayer = playerNode . querySelector ( 'ytd-player' ) ;
417+ if ( ! ytdPlayer ) {
418+ return false ;
419+ }
416420 }
417421
418422 FoundYTPlayer = playerNode ;
Original file line number Diff line number Diff line change @@ -662,7 +662,7 @@ export class SubtitlesManager extends EventEmitter {
662662 cueIndex -- ;
663663 }
664664
665- while ( cueIndex < cues . length && cues [ cueIndex ] . endTime >= currentTime && cues [ cueIndex ] . startTime <= currentTime ) {
665+ while ( cueIndex >= 0 && cueIndex < cues . length && cues [ cueIndex ] . endTime >= currentTime && cues [ cueIndex ] . startTime <= currentTime ) {
666666 const cue = cues [ cueIndex ] ;
667667 if ( ! cue . dom ) {
668668 cue . dom = WebVTT . convertCueToDOMTree ( window , cue . text ) ;
You can’t perform that action at this time.
0 commit comments