Skip to content

Commit

Permalink
Merge pull request #428 from videojs/fix-ie11
Browse files Browse the repository at this point in the history
fix: emsg ie11 test failures
  • Loading branch information
adrums86 committed Feb 21, 2023
2 parents a8146c7 + 15deea7 commit bbaccca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/mp4/emsg.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var uint8ToCString = require('../utils/string.js').uint8ToCString;
var getUint64 = require('../utils/numbers.js').getUint64;

/**
* Based on: ISO/IEC 23009 Section: 5.10.3.3
Expand Down Expand Up @@ -40,7 +41,7 @@ var parseEmsgBox = function(boxData) {
var dv = new DataView(boxData.buffer);
timescale = dv.getUint32(offset);
offset += 4;
presentation_time = Number(dv.getBigUint64(offset));
presentation_time = getUint64(boxData.subarray(offset));
offset += 8;
event_duration = dv.getUint32(offset);
offset += 4;
Expand Down
8 changes: 4 additions & 4 deletions test/mp4-probe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ QUnit.test('can get ID3 data from a v0 EMSG box', function(assert) {
);

var v0EmsgId3Data = mp4Helpers.generateEmsgBoxData(0, id3Data);
var emsgId3Box = new Uint8Array(box('emsg', Array.from(v0EmsgId3Data)));
var emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v0EmsgId3Data)));
var emsgBoxes = probe.getEmsgID3(emsgId3Box, 10);
assert.equal(emsgBoxes[0].cueTime, 20, 'got correct emsg cueTime value from v0 emsg');
assert.equal(emsgBoxes[0].duration, 0, 'got correct emsg duration value from v0 emsg');
Expand All @@ -169,7 +169,7 @@ QUnit.test('can get ID3 data from a v1 EMSG box', function(assert) {
);

var v1EmsgId3Data = mp4Helpers.generateEmsgBoxData(1, id3Data);
var emsgId3Box = new Uint8Array(box('emsg', Array.from(v1EmsgId3Data)));
var emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v1EmsgId3Data)));
var emsgBoxes = probe.getEmsgID3(emsgId3Box);
assert.equal(emsgBoxes[0].cueTime, 100, 'got correct emsg cueTime value from v1 emsg');
assert.equal(emsgBoxes[0].duration, 0.01, 'got correct emsg duration value from v1 emsg');
Expand All @@ -192,10 +192,10 @@ QUnit.test('can get ID3 data from multiple EMSG boxes', function(assert) {
);

var v1EmsgId3Data = mp4Helpers.generateEmsgBoxData(1, v1id3Data);
var v1emsgId3Box = new Uint8Array(box('emsg', Array.from(v1EmsgId3Data)));
var v1emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v1EmsgId3Data)));

var v0EmsgId3Data = mp4Helpers.generateEmsgBoxData(0, v0id3Data);
var v0emsgId3Box = new Uint8Array(box('emsg', Array.from(v0EmsgId3Data)));
var v0emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v0EmsgId3Data)));

var multiBoxData = new Uint8Array(v1emsgId3Box.length + v0emsgId3Box.length);
multiBoxData.set(v1emsgId3Box);
Expand Down

0 comments on commit bbaccca

Please sign in to comment.