Skip to content

Commit

Permalink
fix: expose custom segment property in the segment metadata track
Browse files Browse the repository at this point in the history
  • Loading branch information
forbesjo authored and jforbes committed Mar 14, 2019
1 parent b820f24 commit 91b6aa7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/segment-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,7 @@ export default class SegmentLoader extends videojs.EventTarget {

const Cue = window.WebKitDataCue || window.VTTCue;
const value = {
custom: segment.custom,
dateTimeObject: segment.dateTimeObject,
dateTimeString: segment.dateTimeString,
bandwidth: segmentInfo.playlist.attributes.BANDWIDTH,
Expand Down
14 changes: 10 additions & 4 deletions test/segment-loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ QUnit.module('SegmentLoader: M2TS', function(hooks) {
'segment-metadata track empty when no segments appended');

// Start appending some segments
// Add parsed custom tag data to the segment
playlist.segments[0].custom = { data: true };
probeResponse = { start: 0, end: 9.5 };
this.requests[0].response = new Uint8Array(10).buffer;
this.requests.shift().respond(200, null, '');
Expand All @@ -452,7 +454,8 @@ QUnit.module('SegmentLoader: M2TS', function(hooks) {
codecs: 'mp4a.40.5,avc1.42001e',
byteLength: 10,
dateTimeObject: undefined,
dateTimeString: undefined
dateTimeString: undefined,
custom: { data: true }
};

assert.equal(track.cues.length, 1, 'one cue added for segment');
Expand All @@ -475,7 +478,8 @@ QUnit.module('SegmentLoader: M2TS', function(hooks) {
codecs: 'mp4a.40.5,avc1.42001e',
byteLength: 10,
dateTimeObject: undefined,
dateTimeString: undefined
dateTimeString: undefined,
custom: undefined
};

assert.equal(track.cues.length, 2, 'one cue added for segment');
Expand All @@ -498,7 +502,8 @@ QUnit.module('SegmentLoader: M2TS', function(hooks) {
codecs: 'mp4a.40.5,avc1.42001e',
byteLength: 10,
dateTimeObject: undefined,
dateTimeString: undefined
dateTimeString: undefined,
custom: undefined
};

assert.equal(track.cues.length, 3, 'one cue added for segment');
Expand All @@ -523,7 +528,8 @@ QUnit.module('SegmentLoader: M2TS', function(hooks) {
codecs: 'mp4a.40.5,avc1.42001e',
byteLength: 10,
dateTimeObject: undefined,
dateTimeString: undefined
dateTimeString: undefined,
custom: undefined
};

assert.equal(track.cues.length, 3, 'overlapped cue removed, new one added');
Expand Down

0 comments on commit 91b6aa7

Please sign in to comment.