Skip to content

Commit

Permalink
Do not adjust the end time of metadata cues that overlap with cues of…
Browse files Browse the repository at this point in the history
… another type (id3, emsg, daterange)

Fixes #5531
  • Loading branch information
robwalch committed Jun 5, 2023
1 parent f670acc commit a41088c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/controller/id3-track-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class ID3TrackController implements ComponentAPI {
// Safari doesn't put the timestamp frame in the TextTrack
if (!ID3.isTimeStampFrame(frame)) {
// add a bounds to any unbounded cues
this.updateId3CueEnds(startTime);
this.updateId3CueEnds(startTime, type);

const cue = new Cue(startTime, endTime, '');
cue.value = frame;
Expand All @@ -220,12 +220,16 @@ class ID3TrackController implements ComponentAPI {
}
}

updateId3CueEnds(startTime: number) {
updateId3CueEnds(startTime: number, type: MetadataSchema) {
const cues = this.id3Track?.cues;
if (cues) {
for (let i = cues.length; i--; ) {
const cue = cues[i] as any;
if (cue.startTime < startTime && cue.endTime === MAX_CUE_ENDTIME) {
if (
cue.type === type &&
cue.startTime < startTime &&
cue.endTime === MAX_CUE_ENDTIME
) {
cue.endTime = startTime;
}
}
Expand Down

0 comments on commit a41088c

Please sign in to comment.