Skip to content

Commit

Permalink
fix(id3): ignore unsupported id3 frames (videojs#437)
Browse files Browse the repository at this point in the history
When we get an unsupported id3 frame, we don't parse its time. This ends
up coming back to us as NaN in the timing for the frame. Instead of
trying to create a cue for this frame, ignore it whenever the time isn't
a number or when it isn't finite.

Fixes videojs/video.js#5823
  • Loading branch information
gkatsev committed Mar 21, 2019
1 parent bba49c4 commit 7040b7d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mse/add-text-track-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ export const addTextTrackData = function(sourceHandler, captionArray, metadataAr
metadataArray.forEach(function(metadata) {
let time = metadata.cueTime + this.timestampOffset;

// if time isn't a finite number between 0 and Infinity, like NaN,
// ignore this bit of metadata.
// This likely occurs when you have an non-timed ID3 tag like TIT2,
// which is the "Title/Songname/Content description" frame
if (typeof time !== 'number' || window.isNaN(time) || time < 0 || !(time < Infinity)) {
return;
}

metadata.frames.forEach(function(frame) {
let cue = new Cue(
time,
Expand Down

0 comments on commit 7040b7d

Please sign in to comment.