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

Fix DateRange metadata cue duration with ID3 cues that overlap #5546

Merged
merged 1 commit into from
Jun 6, 2023
Merged
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
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