3bf53170 by David LaPalomento

Expose ID3 frames on cue objects

Pass along the parsed ID3 frame object that corresponds to the genererated VTTCue.
1 parent 5b21807c
......@@ -99,7 +99,7 @@ videojs.Hls.prototype.src = function(src) {
}
metadataStream.on('data', function(metadata) {
var i, frame, time, hexDigit;
var i, cue, frame, time, hexDigit;
// create the metadata track if this is the first ID3 tag we've
// seen
......@@ -118,7 +118,9 @@ videojs.Hls.prototype.src = function(src) {
for (i = 0; i < metadata.frames.length; i++) {
frame = metadata.frames[i];
time = metadata.pts / 1000;
textTrack.addCue(new window.VTTCue(time, time, frame.value || frame.url || frame.id === 'PRIV' && String.fromCharCode.apply(null, frame.data)));
cue = new window.VTTCue(time, time, frame.value || frame.url || '');
cue.frame = frame;
textTrack.addCue(cue);
}
});
})();
......
......@@ -1112,11 +1112,15 @@ test('exposes in-band metadata events as cues', function() {
pts: 2000,
data: new Uint8Array([]),
frames: [{
type: 'TXXX',
id: 'TXXX',
value: 'cue text'
}, {
type: 'WXXX',
id: 'WXXX',
url: 'http://example.com'
}, {
id: 'PRIV',
owner: 'owner@example.com',
privateData: new Uint8Array([1, 2, 3])
}]
});
};
......@@ -1128,7 +1132,7 @@ test('exposes in-band metadata events as cues', function() {
track = player.textTracks()[0];
equal(track.kind, 'metadata', 'kind is metadata');
equal(track.inBandMetadataTrackDispatchType, '15010203BB', 'set the dispatch type');
equal(track.cues.length, 2, 'created two cues');
equal(track.cues.length, 3, 'created three cues');
equal(track.cues[0].startTime, 2, 'cue starts at 2 seconds');
equal(track.cues[0].endTime, 2, 'cue ends at 2 seconds');
equal(track.cues[0].pauseOnExit, false, 'cue does not pause on exit');
......@@ -1138,6 +1142,15 @@ test('exposes in-band metadata events as cues', function() {
equal(track.cues[1].endTime, 2, 'cue ends at 2 seconds');
equal(track.cues[1].pauseOnExit, false, 'cue does not pause on exit');
equal(track.cues[1].text, 'http://example.com', 'set cue text');
equal(track.cues[2].startTime, 2, 'cue starts at 2 seconds');
equal(track.cues[2].endTime, 2, 'cue ends at 2 seconds');
equal(track.cues[2].pauseOnExit, false, 'cue does not pause on exit');
equal(track.cues[2].text, '', 'did not set cue text');
equal(track.cues[2].frame.owner, 'owner@example.com', 'set the owner');
deepEqual(track.cues[2].frame.privateData,
new Uint8Array([1, 2, 3]),
'set the private data');
});
test('drops tags before the target timestamp when seeking', function() {
......