--- a/dom/media/mediasource/test/.eslintrc.js
+++ b/dom/media/mediasource/test/.eslintrc.js
@@ -18,13 +18,13 @@ module.exports = {
"must_throw": false,
"once": false,
"range": false,
"runWithMSE": false,
"waitUntilTime": false
},
// Use const/let instead of var for tighter scoping, avoiding redeclaration
"rules": {
- "array-bracket-spacing": ["error", "always"],
+ "array-bracket-spacing": ["error", "never"],
"no-var": "error",
"prefer-const": "error"
}
};
--- a/dom/media/mediasource/test/mediasource.js
+++ b/dom/media/mediasource/test/mediasource.js
@@ -1,14 +1,14 @@
// Helpers for Media Source Extensions tests
let gMSETestPrefs = [
- [ "media.mediasource.enabled", true ],
- [ "media.audio-max-decode-error", 0 ],
- [ "media.video-max-decode-error", 0 ],
+ ["media.mediasource.enabled", true],
+ ["media.audio-max-decode-error", 0],
+ ["media.video-max-decode-error", 0],
];
// Called before runWithMSE() to set the prefs before running MSE tests.
function addMSEPrefs(...prefs) {
gMSETestPrefs = gMSETestPrefs.concat(prefs);
}
async function runWithMSE(testFunction) {
@@ -182,13 +182,13 @@ async function waitUntilTime(target, tar
});
});
ok(true, "Reached target time of: " + targetTime);
}
// Log events for debugging.
function logEvents(el) {
- [ "suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
+ ["suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
"loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
"waiting", "pause", "durationchange", "seeking",
- "seeked" ].forEach(type => el.addEventListener(type, e => info(`got ${e.type} event`)));
+ "seeked"].forEach(type => el.addEventListener(type, e => info(`got ${e.type} event`)));
}
--- a/dom/media/mediasource/test/test_AVC3_mp4.html
+++ b/dom/media/mediasource/test/test_AVC3_mp4.html
@@ -13,17 +13,17 @@
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, el) => {
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const videosb = ms.addSourceBuffer("video/mp4");
- await fetchAndLoad(videosb, "avc3/init", [ "" ], ".mp4");
+ await fetchAndLoad(videosb, "avc3/init", [""], ".mp4");
const p = once(el, "loadeddata");
await fetchAndLoad(videosb, "avc3/segment", range(1, 2), ".m4s");
await p;
is(videosb.buffered.length, 1, "continuous buffered range");
ok(true, "got loadeddata");
ms.endOfStream();
await once(ms, "sourceended");
ok(true, "endOfStream completed");
--- a/dom/media/mediasource/test/test_AudioChange_mp4.html
+++ b/dom/media/mediasource/test/test_AudioChange_mp4.html
@@ -22,26 +22,26 @@ runWithMSE(async (ms, el) => {
const audiosb = ms.addSourceBuffer("audio/mp4");
el.addEventListener("error", e => {
ok(false, `should not fire ${e.type} event`);
SimpleTest.finish();
});
is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING");
let p = once(el, "loadedmetadata");
- await fetchAndLoad(audiosb, "aac20-48000-64000-", [ "init" ], ".mp4");
+ await fetchAndLoad(audiosb, "aac20-48000-64000-", ["init"], ".mp4");
await p;
ok(true, "got loadedmetadata event");
- p = Promise.all([ once(el, "loadeddata"), once(el, "canplay") ]);
- await fetchAndLoad(audiosb, "aac20-48000-64000-", [ "1" ], ".m4s");
+ p = Promise.all([once(el, "loadeddata"), once(el, "canplay")]);
+ await fetchAndLoad(audiosb, "aac20-48000-64000-", ["1"], ".m4s");
await p;
ok(true, "got canplay event");
el.play();
- await fetchAndLoad(audiosb, "aac51-48000-128000-", [ "init" ], ".mp4");
- await fetchAndLoad(audiosb, "aac51-48000-128000-", [ "2" ], ".m4s");
+ await fetchAndLoad(audiosb, "aac51-48000-128000-", ["init"], ".mp4");
+ await fetchAndLoad(audiosb, "aac51-48000-128000-", ["2"], ".m4s");
ms.endOfStream();
await once(el, "ended");
ok(el.currentTime >= 6, "played to the end");
SimpleTest.finish();
});
</script>
</pre>
--- a/dom/media/mediasource/test/test_BufferingWait_mp4.html
+++ b/dom/media/mediasource/test/test_BufferingWait_mp4.html
@@ -17,33 +17,33 @@ runWithMSE(async (ms, v) => {
ms.addEventListener("sourceopen", () => ok(false, "No more sourceopen"));
const sb = ms.addSourceBuffer("video/mp4");
ok(sb, "Create a SourceBuffer");
sb.addEventListener("error", e => {
ok(false, "Got Error: " + e);
SimpleTest.finish();
});
- await fetchAndLoad(sb, "bipbop/bipbop", [ "init" ], ".mp4");
- await fetchAndLoad(sb, "bipbop/bipbop", [ "1" ], ".m4s");
- await fetchAndLoad(sb, "bipbop/bipbop", [ "2" ], ".m4s");
+ await fetchAndLoad(sb, "bipbop/bipbop", ["init"], ".mp4");
+ await fetchAndLoad(sb, "bipbop/bipbop", ["1"], ".m4s");
+ await fetchAndLoad(sb, "bipbop/bipbop", ["2"], ".m4s");
/* Note - Missing |bipbop3| segment here corresponding to (1.62, 2.41] */
/* Note - Missing |bipbop4| segment here corresponding to (2.41, 3.20] */
- await fetchAndLoad(sb, "bipbop/bipbop", [ "5" ], ".m4s");
+ await fetchAndLoad(sb, "bipbop/bipbop", ["5"], ".m4s");
// last audio sample has a start time of 1.578956s
info("Playing video. It should play for a bit, then fire 'waiting'");
v.play();
await waitUntilTime(v, 1.57895);
const firstStop = Date.now();
- await fetchAndLoad(sb, "bipbop/bipbop", [ "3" ], ".m4s");
+ await fetchAndLoad(sb, "bipbop/bipbop", ["3"], ".m4s");
// last audio sample has a start time of 2.368435
await waitUntilTime(v, 2.36843);
const waitDuration = (Date.now() - firstStop) / 1000;
ok(waitDuration < 15, `Should not spend inordinate amount of time buffering: ${waitDuration}`);
- await fetchAndLoad(sb, "bipbop/bipbop", [ "4" ], ".m4s");
+ await fetchAndLoad(sb, "bipbop/bipbop", ["4"], ".m4s");
ms.endOfStream();
await once(v, "ended");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>
--- a/dom/media/mediasource/test/test_ChangeType.html
+++ b/dom/media/mediasource/test/test_ChangeType.html
@@ -6,27 +6,27 @@
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test"><script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
async function setupTest() {
- await SpecialPowers.pushPrefEnv({"set": [ [ "media.mediasource.experimental.enabled", true ] ]});
+ await SpecialPowers.pushPrefEnv({"set": [["media.mediasource.experimental.enabled", true]]});
}
setupTest();
runWithMSE(function(ms, el) {
el.controls = true;
once(ms, "sourceopen").then(function() {
// Log events for debugging.
- const events = [ "suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
- "loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
- "waiting", "pause", "durationchange", "seeking", "seeked" ];
+ const events = ["suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
+ "loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
+ "waiting", "pause", "durationchange", "seeking", "seeked"];
function logEvent(e) {
info("got " + e.type + " event");
}
events.forEach(function(e) {
el.addEventListener(e, logEvent);
});
ok(true, "Receive a sourceopen event");
@@ -37,44 +37,44 @@ runWithMSE(function(ms, el) {
}
el.addEventListener("error", function(e) {
ok(false, "should not fire '" + e.type + "' event");
SimpleTest.finish();
});
is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING");
const loadedmetadataPromises = [];
- loadedmetadataPromises.push(fetchAndLoad(videosb, "bipbop/bipbop", [ "init" ], ".mp4"));
+ loadedmetadataPromises.push(fetchAndLoad(videosb, "bipbop/bipbop", ["init"], ".mp4"));
loadedmetadataPromises.push(once(el, "loadedmetadata"));
Promise.all(loadedmetadataPromises)
.then(function() {
ok(true, "got loadedmetadata event");
const canplayPromises = [];
canplayPromises.push(once(el, "loadeddata"));
canplayPromises.push(once(el, "canplay"));
canplayPromises.push(fetchAndLoad(videosb, "bipbop/bipbop", range(1, 3), ".m4s"));
return Promise.all(canplayPromises);
})
.then(function() {
ok(true, "got canplay event");
el.play();
videosb.timestampOffset = el.buffered.end(0);
- return fetchAndLoad(videosb, "bipbop/bipbop_480_624kbps-video", [ "init" ], ".mp4");
+ return fetchAndLoad(videosb, "bipbop/bipbop_480_624kbps-video", ["init"], ".mp4");
})
.then(fetchAndLoad.bind(null, videosb, "bipbop/bipbop_480_624kbps-video", range(1, 3), ".m4s"))
.then(function() {
videosb.timestampOffset = el.buffered.end(0);
try {
videosb.changeType("video/webm");
} catch (e) {
ok(false, "shouldn't throw an exception");
SimpleTest.finish();
throw e;
}
- return fetchAndLoad(videosb, "bipbop/bipbop_300-3s", [ "" ], ".webm");
+ return fetchAndLoad(videosb, "bipbop/bipbop_300-3s", [""], ".webm");
})
.then(function() {
ms.endOfStream();
return once(el, "ended");
})
.then(function() {
ok(el.currentTime >= el.buffered.end(0), "played to the end");
SimpleTest.finish();
--- a/dom/media/mediasource/test/test_ChangeWhileWaitingOnMissingData_mp4.html
+++ b/dom/media/mediasource/test/test_ChangeWhileWaitingOnMissingData_mp4.html
@@ -11,25 +11,25 @@
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, el) => {
el.controls = true;
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const sb = ms.addSourceBuffer("video/mp4");
- await fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", [ "init" ], ".mp4");
+ await fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", ["init"], ".mp4");
await fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", range(1, 3), ".m4s");
el.play();
// let seek to the last audio frame.
// The seek will complete and then playback will stall.
el.currentTime = 1.532517;
- await Promise.all([ once(el, "seeked"), once(el, "waiting") ]);
+ await Promise.all([once(el, "seeked"), once(el, "waiting")]);
info("seek completed");
- await fetchAndLoad(sb, "bipbop/bipbop", [ "init" ], ".mp4");
+ await fetchAndLoad(sb, "bipbop/bipbop", ["init"], ".mp4");
await fetchAndLoad(sb, "bipbop/bipbop", range(1, 4), ".m4s");
ms.endOfStream();
await once(el, "ended");
SimpleTest.finish();
});
</script>
</pre>
--- a/dom/media/mediasource/test/test_DrainOnMissingData_mp4.html
+++ b/dom/media/mediasource/test/test_DrainOnMissingData_mp4.html
@@ -11,34 +11,34 @@
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, el) => {
el.controls = true;
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const videosb = ms.addSourceBuffer("video/mp4");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
// Set appendWindowEnd to ensure we only have about 6 frames worth.
// We must feed at least 6 frames to pass the MDSM pre-roll.
videosb.appendWindowEnd = .4;
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "1" ], ".m4s");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["1"], ".m4s");
info("Invoking play()");
const p = once(el, "playing");
await el.play();
await p;
info("got playing");
await once(el, "waiting");
info("got waiting");
info("Loading more data");
// Waiting will be fired on the last frame +- 40ms.
isfuzzy(el.currentTime, videosb.buffered.end(0) - 1 / 30,
0.04, `Got a waiting event at ${el.currentTime}`);
videosb.appendWindowEnd = 1;
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ 1 ], ".m4s");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", [1], ".m4s");
ms.endOfStream();
await once(el, "ended");
// These fuzz factors are bigger than they should be. We should investigate
// and fix them in bug 1137574.
is(el.duration, 0.801666, "Video has correct duration: " + el.duration);
is(el.currentTime, el.duration, "Video has correct currentTime.");
SimpleTest.finish();
});
--- a/dom/media/mediasource/test/test_DurationChange.html
+++ b/dom/media/mediasource/test/test_DurationChange.html
@@ -13,17 +13,17 @@
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, v) => {
await once(ms, "sourceopen");
const sb = ms.addSourceBuffer("video/webm");
const arrayBuffer = await fetchWithXHR("seek.webm");
sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 318));
- await Promise.all([ once(v, "loadedmetadata"), once(sb, "updateend") ]);
+ await Promise.all([once(v, "loadedmetadata"), once(sb, "updateend")]);
is(v.duration, ms.duration, "video duration is mediasource one");
must_not_throw(() => ms.duration = 0, "duration = 0 is valid initially");
is(v.duration, 0, "reducing duration with no data buffered is valid");
sb.appendBuffer(new Uint8Array(arrayBuffer, 318));
// Adding more data will fire durationchange.
await once(sb, "updateend");
ok(true, "got updateend");
// XXX: Duration should be exactly 4.0, see bug 1065207.
--- a/dom/media/mediasource/test/test_DurationUpdated.html
+++ b/dom/media/mediasource/test/test_DurationUpdated.html
@@ -18,17 +18,17 @@ runWithMSE(async (ms, v) => {
let durationChangeCount = 0;
v.addEventListener("durationchange", () => durationChangeCount++);
const arrayBuffer = await fetchWithXHR("seek.webm");
sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 318));
// Adding the first init segment will fire a durationchange.
- await Promise.all([ once(sb, "updateend"), once(v, "loadedmetadata") ]);
+ await Promise.all([once(sb, "updateend"), once(v, "loadedmetadata")]);
ok(true, "got loadedmetadata");
// Set mediasource duration to 0, so future appendBuffer
// will update the mediasource duration.
// Changing the duration will fire a durationchange.
ms.duration = 0;
sb.appendBuffer(new Uint8Array(arrayBuffer, 318));
// Adding more data will fire durationchange.
await once(sb, "updateend");
--- a/dom/media/mediasource/test/test_DurationUpdated_mp4.html
+++ b/dom/media/mediasource/test/test_DurationUpdated_mp4.html
@@ -18,17 +18,17 @@ runWithMSE(async (ms, v) => {
let durationChangeCount = 0;
v.addEventListener("durationchange", () => durationChangeCount++);
const arrayBuffer = await fetchWithXHR("bipbop/bipbop2s.mp4");
sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 1395));
// Adding the first init segment will fire a durationchange.
- await Promise.all([ once(sb, "updateend"), once(v, "loadedmetadata") ]);
+ await Promise.all([once(sb, "updateend"), once(v, "loadedmetadata")]);
ok(true, "got loadedmetadata");
// Set mediasource duration to 0, so future appendBuffer
// will update the mediasource duration.
// Changing the duration will fire a durationchange.
ms.duration = 0;
sb.appendBuffer(new Uint8Array(arrayBuffer, 1395));
// Adding more data will fire durationchange.
await once(sb, "updateend");
--- a/dom/media/mediasource/test/test_Eviction_mp4.html
+++ b/dom/media/mediasource/test/test_Eviction_mp4.html
@@ -11,27 +11,27 @@
SimpleTest.waitForExplicitFinish();
// We fill up the source buffer with audio data until the buffer is full.
// We ensure that QuotaExceededError is thrown once the buffer is full.
// We then seek to half the content. By that time, another appendBuffer must succeed
// as the auto-eviction would succeed (removing all data prior currentTime)
addMSEPrefs(
- [ "media.mediasource.eviction_threshold.audio", 524288 ],
- [ "media.dormant-on-pause-timeout-ms", -1 ] // FIXME: bug 1319292
+ ["media.mediasource.eviction_threshold.audio", 524288],
+ ["media.dormant-on-pause-timeout-ms", -1] // FIXME: bug 1319292
);
runWithMSE(async (ms, el) => {
el.controls = true;
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const audiosb = ms.addSourceBuffer("audio/mp4");
audiosb.mode = "sequence";
- await fetchAndLoad(audiosb, "bipbop/bipbop_audio", [ "init" ], ".mp4");
+ await fetchAndLoad(audiosb, "bipbop/bipbop_audio", ["init"], ".mp4");
const audioBuffer = await fetchWithXHR("bipbop/bipbop_audio1.m4s");
await must_reject(async () => {
// We are appending data repeatedly in sequence mode, there should be no gaps.
while (true) {
ok(audiosb.buffered.length <= 1, "there should be no gap in buffered ranges.");
audiosb.appendBuffer(audioBuffer);
await once(audiosb, "updateend");
--- a/dom/media/mediasource/test/test_ExperimentalAsync.html
+++ b/dom/media/mediasource/test/test_ExperimentalAsync.html
@@ -7,19 +7,19 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test"><script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
addMSEPrefs(
- [ "media.mediasource.eviction_threshold.audio", 524288 ],
- [ "media.dormant-on-pause-timeout-ms", -1 ], // FIXME: bug 1319292
- [ "media.mediasource.experimental.enabled", true ]
+ ["media.mediasource.eviction_threshold.audio", 524288],
+ ["media.dormant-on-pause-timeout-ms", -1], // FIXME: bug 1319292
+ ["media.mediasource.experimental.enabled", true]
);
// We fill up the source buffer with audio data until the buffer is full.
// We ensure that QuotaExceededError is thrown once the buffer is full.
// We then seek to half the content. By that time, another appendBuffer must succeed
// as the auto-eviction would succeed (removing all data prior currentTime)
// The test then fills the audio buffer and plays until the end.
--- a/dom/media/mediasource/test/test_FrameSelection.html
+++ b/dom/media/mediasource/test/test_FrameSelection.html
@@ -36,25 +36,25 @@ runWithMSE(async (ms, v) => {
// Append media segment covering range [2, 4].
p = once(sb, "updateend");
sb.appendBuffer(new Uint8Array(arrayBuffer, 51003));
await p;
ms.endOfStream();
info("Seeking to t=3");
- p = Promise.all([ once(v, "seeked"), once(v, "resize") ]);
+ p = Promise.all([once(v, "seeked"), once(v, "resize")]);
v.currentTime = 3;
await p;
is(v.currentTime, 3, "Video currentTime at target");
is(v.videoWidth, 160, "videoWidth has correct low-res value");
is(v.videoHeight, 120, "videoHeight has correct low-res value");
info("Seeking to t=1");
- p = Promise.all([ once(v, "seeked"), once(v, "resize") ]);
+ p = Promise.all([once(v, "seeked"), once(v, "resize")]);
v.currentTime = 1;
await p;
is(v.currentTime, 1, "Video currentTime at target");
is(v.videoWidth, 320, "videoWidth has correct high-res value");
is(v.videoHeight, 240, "videoHeight has correct high-res value");
SimpleTest.finish();
});
--- a/dom/media/mediasource/test/test_FrameSelection_mp4.html
+++ b/dom/media/mediasource/test/test_FrameSelection_mp4.html
@@ -20,30 +20,30 @@ runWithMSE(async (ms, v) => {
ms.addEventListener("sourceopen", () => ok(false, "No more sourceopen"));
const sb = ms.addSourceBuffer("video/mp4");
ok(sb, "Create a SourceBuffer");
logEvents(v);
sb.addEventListener("error", function(e) {
ok(false, `should not fire ${e.type} event`);
SimpleTest.finish();
});
- await fetchAndLoad(sb, "bipbop/bipbop", [ "init" ], ".mp4");
+ await fetchAndLoad(sb, "bipbop/bipbop", ["init"], ".mp4");
const p = once(v, "loadeddata");
await fetchAndLoad(sb, "bipbop/bipbop", range(1, 3), ".m4s");
await p;
is(sb.buffered.length, 1, "continuous range");
v.play();
// We have nothing to play, waiting will be fired.
await waitUntilTime(v, 1.5);
- await fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", [ "init" ], ".mp4");
+ await fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", ["init"], ".mp4");
sb.timestampOffset = 1.601666; // End of the video track buffered - time of first video sample (0.095).
sb.appendWindowEnd = 1.796677; // Only allow room for three extra video frames (we need 3 as this video has b-frames).
- await fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", [ "1" ], ".m4s");
+ await fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", ["1"], ".m4s");
ms.endOfStream();
- await Promise.all([ once(ms, "sourceended"), once(v, "playing"), once(v, "ended") ]);
+ await Promise.all([once(ms, "sourceended"), once(v, "playing"), once(v, "ended")]);
if (v.width, 640, "has proper width");
if (v.height, 480, "has proper height");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>
--- a/dom/media/mediasource/test/test_LiveSeekable.html
+++ b/dom/media/mediasource/test/test_LiveSeekable.html
@@ -15,17 +15,17 @@ SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, v) => {
await once(ms, "sourceopen");
const sb = ms.addSourceBuffer("video/webm");
// Load data with a +2 offset so that we can distinguish buffered range start
// and seekable range start.
sb.timestampOffset = 2;
const p = once(v, "loadedmetadata");
- await fetchAndLoad(sb, "seek", [ "" ], ".webm");
+ await fetchAndLoad(sb, "seek", [""], ".webm");
await p;
ms.duration = Infinity;
sb.abort();
is(sb.buffered.length, 1, "continuous buffered range");
is(sb.buffered.start(0), 2, "buffered range start at timestamp offset");
is(sb.buffered.end(0), 6.001, "buffered range end at original duration + timestamp offset");
is(v.seekable.length, 1, "continuous seekable range");
is(v.seekable.start(0), 0, "seekable range start at 0");
--- a/dom/media/mediasource/test/test_LoadedDataFired_mp4.html
+++ b/dom/media/mediasource/test/test_LoadedDataFired_mp4.html
@@ -24,17 +24,17 @@ runWithMSE(async (ms, el) => {
is(el.buffered.start(0), 0, "must fire playing when data has been loaded");
ok(el.currentTime >= 0, "must have started playback");
});
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const videosb = ms.addSourceBuffer("video/mp4");
is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING");
let p = once(el, "loadedmetadata");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await p;
videosb.appendWindowStart = 2;
videosb.appendWindowEnd = 4;
is(el.readyState, el.HAVE_METADATA, "readyState is HAVE_METADATA");
// Load [2.4, 3.968344). 2.4 as it's the first keyframe after 2s and
// 3.968344 as the last frame ends after 4s.
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 8), ".m4s");
is(el.readyState, el.HAVE_METADATA, "readyState is HAVE_METADATA");
--- a/dom/media/mediasource/test/test_MediaSource_disabled.html
+++ b/dom/media/mediasource/test/test_MediaSource_disabled.html
@@ -16,16 +16,16 @@ function test() {
"MediaSource should be hidden behind a pref");
SimpleTest.doesThrow(() => new MediaSource,
"MediaSource should be hidden behind a pref");
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv({"set":
[
- [ "media.mediasource.enabled", false ],
+ ["media.mediasource.enabled", false],
]
}, test);
</script>
</pre>
</body>
</html>
--- a/dom/media/mediasource/test/test_MediaSource_flac_mp4.html
+++ b/dom/media/mediasource/test/test_MediaSource_flac_mp4.html
@@ -14,17 +14,17 @@ SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, el) => {
el.controls = true;
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
is(ms.readyState, "open", "MediaSource must be in open state after sourceopen");
const sb = ms.addSourceBuffer("audio/mp4; codecs=\"flac\"");
ok(sb, "Create a SourceBuffer");
- await fetchAndLoad(sb, "flac/IS", [ "" ], ".mp4");
+ await fetchAndLoad(sb, "flac/IS", [""], ".mp4");
await fetchAndLoad(sb, "flac/0000", range(1, 3), ".m4s");
el.play();
ms.endOfStream();
await once(el, "ended");
SimpleTest.finish();
});
</script>
--- a/dom/media/mediasource/test/test_MediaSource_memory_reporting.html
+++ b/dom/media/mediasource/test/test_MediaSource_memory_reporting.html
@@ -11,17 +11,17 @@
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, v) => {
// Load a webm video and play it.
await once(ms, "sourceopen");
const sb = ms.addSourceBuffer("video/webm");
- await fetchAndLoad(sb, "seek", [ "" ], ".webm");
+ await fetchAndLoad(sb, "seek", [""], ".webm");
const p = once(v, "ended");
ms.endOfStream();
v.play();
await p;
// Test that memory reporting works once we've played a video.
// Grab a memory report.
const mgr = SpecialPowers.Cc["@mozilla.org/memory-reporter-manager;1"]
--- a/dom/media/mediasource/test/test_MultipleInitSegments.html
+++ b/dom/media/mediasource/test/test_MultipleInitSegments.html
@@ -14,20 +14,20 @@
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, v) => {
await once(ms, "sourceopen");
const sb = ms.addSourceBuffer("video/webm");
const seek_lowres = await fetchWithXHR("seek_lowres.webm");
const seek = await fetchWithXHR("seek.webm");
const data = [
- [ seek_lowres, 0, 438 ], // lowres init segment
- [ seek_lowres, 438, 25950 ], // lowres media segment 0-1
- [ seek, 0, 318 ], // init segment
- [ seek, 46712, 67833 ] // media segment 0.8-1.201
+ [seek_lowres, 0, 438], // lowres init segment
+ [seek_lowres, 438, 25950], // lowres media segment 0-1
+ [seek, 0, 318], // init segment
+ [seek, 46712, 67833] // media segment 0.8-1.201
];
const length = data.map(d => d[2] - d[1]).reduce((a, b) => a + b, 0);
const arrayBuffer = new Uint8Array(length);
let pos = 0;
for (const d of data) {
const buffer = new Uint8Array(d[0], d[1], d[2] - d[1]);
arrayBuffer.set(buffer, pos);
pos += buffer.byteLength;
--- a/dom/media/mediasource/test/test_MultipleInitSegments_mp4.html
+++ b/dom/media/mediasource/test/test_MultipleInitSegments_mp4.html
@@ -14,17 +14,17 @@
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, v) => {
await once(ms, "sourceopen");
const sb = ms.addSourceBuffer("video/mp4");
const init = new Uint8Array(await fetchWithXHR("bipbop/bipbop_videoinit.mp4"));
const segment1 = new Uint8Array(await fetchWithXHR("bipbop/bipbop_video1.m4s"));
const segment2 = new Uint8Array(await fetchWithXHR("bipbop/bipbop_video2.m4s"));
- const data = [ init, segment1, init, segment2 ];
+ const data = [init, segment1, init, segment2];
const length = data.map(d => d.byteLength).reduce((a, b) => a + b, 0);
const arrayBuffer = new Uint8Array(length);
let pos = 0;
for (const buffer of data) {
arrayBuffer.set(buffer, pos);
pos += buffer.byteLength;
}
await loadSegment(sb, arrayBuffer);
--- a/dom/media/mediasource/test/test_OnEvents.html
+++ b/dom/media/mediasource/test/test_OnEvents.html
@@ -10,33 +10,33 @@
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, v) => {
const receiveEvent = e => v["got" + e] = true;
- const msevents = [ "onsourceopen", "onsourceended" ];
+ const msevents = ["onsourceopen", "onsourceended"];
msevents.forEach(e => ms[e] = () => receiveEvent(e));
- const sblistevents = [ "onaddsourcebuffer", "onremovesourcebuffer" ];
+ const sblistevents = ["onaddsourcebuffer", "onremovesourcebuffer"];
sblistevents.forEach(e => ms.sourceBuffers[e] = () => receiveEvent(e));
await once(ms, "sourceopen");
const sb = ms.addSourceBuffer("video/webm");
- const sbevents = [ "onupdatestart", "onupdate", "onupdateend", "onabort" ];
+ const sbevents = ["onupdatestart", "onupdate", "onupdateend", "onabort"];
sbevents.forEach(e => sb[e] = () => receiveEvent(e));
- await fetchAndLoad(sb, "seek", [ "" ], ".webm");
+ await fetchAndLoad(sb, "seek", [""], ".webm");
sb.appendBuffer(await fetchWithXHR("seek.webm"));
ms.removeSourceBuffer(sb); // will fire abort and removesourcebuffer
ms.endOfStream(); // will fire sourceended
await once(ms, "sourceended");
- [ ...msevents, ...sbevents, ...sblistevents ].forEach(e => ok(v["got" + e], "got " + e));
+ [...msevents, ...sbevents, ...sblistevents].forEach(e => ok(v["got" + e], "got " + e));
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>
--- a/dom/media/mediasource/test/test_PlayEvents.html
+++ b/dom/media/mediasource/test/test_PlayEvents.html
@@ -28,20 +28,20 @@ runWithMSE(async (ms, el) => {
ok(true, "Receive a sourceopen event");
const videosb = ms.addSourceBuffer("video/mp4");
el.addEventListener("error", e => {
ok(false, `should not fire ${e.type} event`);
SimpleTest.finish();
});
is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING");
let p = once(el, "loadedmetadata");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await p;
ok(true, "got loadedmetadata event");
- p = Promise.all([ once(el, "loadeddata"), once(el, "canplay") ]);
+ p = Promise.all([once(el, "loadeddata"), once(el, "canplay")]);
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 3), ".m4s");
await p;
ok(true, "got canplay event");
// set element duration to 3.203333s. We do so in order to guarantee that
// the end of the buffered range will be equal to duration, causing
// canplaythrough to be fired later.
ms.duration = 3.203333;
await once(el, "durationchange");
@@ -59,17 +59,17 @@ runWithMSE(async (ms, el) => {
// An arbitrary value, so we are guaranteed to be in a range with no data.
el.currentTime = 6;
videosb.timestampOffset = 6;
ok(el.seeking, "seeking started");
await once(el, "seeking");
ok(true, "got seeking event");
is(el.readyState, el.HAVE_METADATA, "readyState is HAVE_METADATA");
// Load [6+0, 6+1.601666)
- p = Promise.all([ once(el, "seeked"), once(el, "canplay") ]);
+ p = Promise.all([once(el, "seeked"), once(el, "canplay")]);
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 3), ".m4s");
await p;
ok(true, "got seeked and canplay event");
is(el.currentTime, 6, "seeked to 6s");
is(el.readyState, el.HAVE_FUTURE_DATA, "readyState is HAVE_FUTURE_DATA");
// Load [6+1.60166, 6+3.203333]
p = once(el, "canplaythrough");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(3, 5), ".m4s");
@@ -89,25 +89,25 @@ runWithMSE(async (ms, el) => {
p = once(el, "seeked");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 3), ".m4s");
await p;
ok(true, "got seeked event");
// Load [15+1.60166, 15+3.203333]
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(3, 5), ".m4s");
ok(true, "data loaded");
// Playback we play for a little while then stall.
- p = Promise.all([ once(el, "playing"), once(el, "waiting") ]);
+ p = Promise.all([once(el, "playing"), once(el, "waiting")]);
el.play();
await p;
ok(true, "got playing and waiting event");
// Playback has stalled, readyState is back to HAVE_CURRENT_DATA.
is(el.readyState, el.HAVE_CURRENT_DATA, "readyState is HAVE_CURRENT_DATA");
// Load [15+3.203333, 15+4.805)
// Our final buffered range will now be [0, 3.203333)[6, 9.203333)[15, 19.805)
- p = Promise.all([ once(el, "playing"), once(el, "canplay"), once(el, "canplaythrough") ]);
+ p = Promise.all([once(el, "playing"), once(el, "canplay"), once(el, "canplaythrough")]);
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(5, 7), ".m4s");
await p;
ok(true, "got playing, canplay and canplaythrough event");
SimpleTest.finish();
});
</script>
</pre>
--- a/dom/media/mediasource/test/test_PlayEventsAutoPlaying.html
+++ b/dom/media/mediasource/test/test_PlayEventsAutoPlaying.html
@@ -34,22 +34,22 @@ runWithMSE(async (ms, el) => {
const videosb = ms.addSourceBuffer("video/mp4");
el.addEventListener("error", e => {
ok(false, `should not fire ${e.type} event`);
SimpleTest.finish();
});
is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING");
let p = once(el, "loadedmetadata");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await p;
ok(true, "got loadedmetadata event");
// We're only adding 1.6s worth of data, not enough for readyState to change to HAVE_ENOUGH_DATA
// So we end the media source so that all the playable data is available.
- p = Promise.all([ "loadeddata", "canplay", "play", "playing", "ended" ].map(e => once(el, e)));
+ p = Promise.all(["loadeddata", "canplay", "play", "playing", "ended"].map(e => once(el, e)));
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 3), ".m4s");
ms.endOfStream();
await p;
ok(true, "got all required event");
SimpleTest.finish();
});
</script>
--- a/dom/media/mediasource/test/test_PlayEventsAutoPlaying2.html
+++ b/dom/media/mediasource/test/test_PlayEventsAutoPlaying2.html
@@ -34,23 +34,23 @@ runWithMSE(async (ms, el) => {
const videosb = ms.addSourceBuffer("video/mp4");
el.addEventListener("error", e => {
ok(false, `should not fire ${e.type} event`);
SimpleTest.finish();
});
is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING");
let p = once(el, "loadedmetadata");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await p;
ok(true, "got loadedmetadata event");
// We shift the timestamps slightly to create a small gaps at the start.
// one that should normally be ignored.
videosb.timestampOffset = 0.1;
- p = Promise.all([ "loadeddata", "canplay", "play", "playing" ].map(e => once(el, e)));
+ p = Promise.all(["loadeddata", "canplay", "play", "playing"].map(e => once(el, e)));
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 14), ".m4s");
await p;
ok(true, "got all required event");
SimpleTest.finish();
});
</script>
</pre>
--- a/dom/media/mediasource/test/test_ResumeAfterClearing_mp4.html
+++ b/dom/media/mediasource/test/test_ResumeAfterClearing_mp4.html
@@ -16,29 +16,29 @@ runWithMSE(async (ms, v) => {
ok(true, "Receive a sourceopen event");
ms.addEventListener("sourceopen", () => ok(false, "No more sourceopen"));
const sb = ms.addSourceBuffer("video/mp4");
ok(sb, "Create a SourceBuffer");
sb.addEventListener("error", e => {
ok(false, "Got Error: " + e);
SimpleTest.finish();
});
- await fetchAndLoad(sb, "bipbop/bipbop", [ "init" ], ".mp4");
+ await fetchAndLoad(sb, "bipbop/bipbop", ["init"], ".mp4");
let p = once(v, "loadeddata");
await fetchAndLoad(sb, "bipbop/bipbop", range(1, 3), ".m4s");
await p;
// clear the entire sourcebuffer.
sb.remove(0, 5);
await once(sb, "updateend");
v.play();
// We have nothing to play, waiting will be fired.
await once(v, "waiting");
p = once(v, "playing");
await fetchAndLoad(sb, "bipbop/bipbop", range(1, 4), ".m4s");
await p;
ms.endOfStream();
- await Promise.all([ once(ms, "sourceended"), once(v, "ended") ]);
+ await Promise.all([once(ms, "sourceended"), once(v, "ended")]);
SimpleTest.finish(SimpleTest);
});
</script>
</pre>
</body>
</html>
--- a/dom/media/mediasource/test/test_SeekNoData_mp4.html
+++ b/dom/media/mediasource/test/test_SeekNoData_mp4.html
@@ -22,18 +22,18 @@ runWithMSE(async (ms, el) => {
ok(false, `should not fire ${e.type} event`);
SimpleTest.finish();
});
is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING");
must_not_throw(() => el.currentTime = 3, "setting currentTime is valid");
is(el.currentTime, 3, "currentTime is default playback start position");
is(el.seeking, false, "seek not started with HAVE_NOTHING");
await Promise.all([
- fetchAndLoad(audiosb, "bipbop/bipbop_audio", [ "init" ], ".mp4"),
- fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4"),
+ fetchAndLoad(audiosb, "bipbop/bipbop_audio", ["init"], ".mp4"),
+ fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4"),
once(el, "loadedmetadata")
]);
const p = once(el, "seeking");
el.play();
el.currentTime = 5;
is(el.readyState, el.HAVE_METADATA, "readyState is HAVE_METADATA");
is(el.seeking, true, "seek not started with HAVE_METADATA");
is(el.currentTime, 5, "currentTime is seek position");
--- a/dom/media/mediasource/test/test_SeekToEnd_mp4.html
+++ b/dom/media/mediasource/test/test_SeekToEnd_mp4.html
@@ -14,25 +14,25 @@ SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, el) => {
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const videosb = ms.addSourceBuffer("video/mp4");
const audiosb = ms.addSourceBuffer("audio/mp4");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 6), ".m4s");
- await fetchAndLoad(audiosb, "bipbop/bipbop_audio", [ "init" ], ".mp4");
+ await fetchAndLoad(audiosb, "bipbop/bipbop_audio", ["init"], ".mp4");
is(videosb.buffered.length, 1, "continuous buffered range");
// Ensure we have at least 2s less audio than video.
audiosb.appendWindowEnd = videosb.buffered.end(0) - 2;
await fetchAndLoad(audiosb, "bipbop/bipbop_audio", range(1, 6), ".m4s");
ms.endOfStream();
- await Promise.all([ once(el, "durationchange"), once(ms, "sourceended") ]);
+ await Promise.all([once(el, "durationchange"), once(ms, "sourceended")]);
ok(true, "endOfStream completed");
// Seek to the middle of the gap where audio is missing. As we are in readyState = ended
// seeking must complete.
el.currentTime = videosb.buffered.end(0) / 2 + audiosb.buffered.end(0) / 2;
ok(el.currentTime - audiosb.buffered.end(0) > 1, "gap is big enough");
is(el.buffered.length, 1, "continuous buffered range");
is(el.buffered.end(0), videosb.buffered.end(0),
"buffered range end is aligned with longest track");
--- a/dom/media/mediasource/test/test_SeekToLastFrame_mp4.html
+++ b/dom/media/mediasource/test/test_SeekToLastFrame_mp4.html
@@ -11,17 +11,17 @@
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, el) => {
el.controls = true;
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const sb = ms.addSourceBuffer("video/mp4");
- await fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", [ "init" ], ".mp4");
+ await fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", ["init"], ".mp4");
await fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", range(1, 3), ".m4s");
el.play();
// let seek to the last audio frame.
el.currentTime = 1.532517;
await once(el, "seeked");
ok(true, "seek completed");
ms.endOfStream();
await once(el, "ended");
--- a/dom/media/mediasource/test/test_SeekTwice_mp4.html
+++ b/dom/media/mediasource/test/test_SeekTwice_mp4.html
@@ -13,20 +13,20 @@
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, el) => {
el.controls = true;
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const audiosb = ms.addSourceBuffer("audio/mp4");
const videosb = ms.addSourceBuffer("video/mp4");
- await fetchAndLoad(audiosb, "bipbop/bipbop_audio", [ "init" ], ".mp4");
+ await fetchAndLoad(audiosb, "bipbop/bipbop_audio", ["init"], ".mp4");
await fetchAndLoad(audiosb, "bipbop/bipbop_audio", range(1, 5), ".m4s");
await fetchAndLoad(audiosb, "bipbop/bipbop_audio", range(6, 12), ".m4s");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 6), ".m4s");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(7, 14), ".m4s");
let p = once(el, "seeking");
el.play();
el.currentTime = 4.5; // Seek to a gap in the video
await p;
ok(true, "Got seeking event");
p = once(el, "seeked");
--- a/dom/media/mediasource/test/test_SeekedEvent_mp4.html
+++ b/dom/media/mediasource/test/test_SeekedEvent_mp4.html
@@ -9,39 +9,39 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, el) => {
el.controls = true;
- const events = [ "seeked", "loadeddata", "playing" ];
+ const events = ["seeked", "loadeddata", "playing"];
let eventCount = 0;
events.forEach(type => el.addEventListener(type,
() => is(events[eventCount++], type, "events must come in order")));
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const videosb = ms.addSourceBuffer("video/mp4");
is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING");
let p = once(el, "loadedmetadata");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await p;
el.play();
videosb.timestampOffset = 2;
is(el.readyState, el.HAVE_METADATA, "readyState is HAVE_METADATA");
// Load [2, 3.606).
p = once(el, "play");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "1" ], ".m4s");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["1"], ".m4s");
await p;
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "2" ], ".m4s");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["2"], ".m4s");
// TODO: readyState should be at least HAVE_CURRENTDATA, see bug 1367993.
ok(el.readyState >= el.HAVE_METADATA, "readyState is HAVE_METADATA");
el.currentTime = 2;
- await Promise.all([ once(el, "seeked"), once(el, "playing") ]);
+ await Promise.all([once(el, "seeked"), once(el, "playing")]);
ok(true, "completed seek");
is(eventCount, events.length, "Received expected number of events");
SimpleTest.finish();
});
</script>
</pre>
</body>
--- a/dom/media/mediasource/test/test_Sequence_mp4.html
+++ b/dom/media/mediasource/test/test_Sequence_mp4.html
@@ -18,19 +18,19 @@ runWithMSE(async (ms, v) => {
const sb = ms.addSourceBuffer("video/mp4");
ok(sb, "Create a SourceBuffer");
sb.addEventListener("error", e => {
ok(false, "Got Error: " + e);
SimpleTest.finish();
});
sb.mode = "sequence";
- await fetchAndLoad(sb, "bipbop/bipbop_video", [ "init" ], ".mp4");
- await fetchAndLoad(sb, "bipbop/bipbop_video", [ "5" ], ".m4s");
- await fetchAndLoad(sb, "bipbop/bipbop_video", [ "2" ], ".m4s");
+ await fetchAndLoad(sb, "bipbop/bipbop_video", ["init"], ".mp4");
+ await fetchAndLoad(sb, "bipbop/bipbop_video", ["5"], ".m4s");
+ await fetchAndLoad(sb, "bipbop/bipbop_video", ["2"], ".m4s");
is(v.buffered.length, 1, "Continuous buffered range");
is(v.buffered.start(0), 0, "Buffered range starts at 0");
ok(sb.timestampOffset > 0, "SourceBuffer.timestampOffset set to allow continuous range");
SimpleTest.finish();
});
</script>
</pre>
</body>
--- a/dom/media/mediasource/test/test_Threshold_mp4.html
+++ b/dom/media/mediasource/test/test_Threshold_mp4.html
@@ -14,19 +14,19 @@ SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, el) => {
const threshold = 0.5; // gap threshold in seconds.
const fuzz = 0.000001; // fuzz when comparing double.
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const videosb = ms.addSourceBuffer("video/mp4");
- const vchunks = [ {start: 0, end: 3.203333}, { start: 3.203333, end: 6.406666} ];
+ const vchunks = [{start: 0, end: 3.203333}, { start: 3.203333, end: 6.406666}];
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 5), ".m4s");
// We will insert a gap of threshold
videosb.timestampOffset = threshold;
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(5, 9), ".m4s");
// HTMLMediaElement fires 'waiting' if somebody invokes |play()| before the MDSM
// has notified it of available data. Make sure that we get 'playing' before
// we starting waiting for 'waiting'.
info("Invoking play()");
--- a/dom/media/mediasource/test/test_TimestampOffset_mp4.html
+++ b/dom/media/mediasource/test/test_TimestampOffset_mp4.html
@@ -20,23 +20,23 @@ runWithMSE(async (ms, el) => {
ok(true, "Receive a sourceopen event");
const audiosb = ms.addSourceBuffer("audio/mp4");
const videosb = ms.addSourceBuffer("video/mp4");
// We divide the video into 3 chunks:
// chunk 0: segments 1-4
// chunk 1: segments 5-8
// chunk 2: segments 9-13
// We then fill the timeline so that it seamlessly plays the chunks in order 0, 2, 1.
- const vchunks = [ {start: 0, end: 3.2033},
+ const vchunks = [{start: 0, end: 3.2033},
{ start: 3.2033, end: 6.4066},
- { start: 6.4066, end: 10.01} ];
+ { start: 6.4066, end: 10.01}];
const firstvoffset = vchunks[2].end - vchunks[2].start; // Duration of chunk 2
const secondvoffset = -(vchunks[1].end - vchunks[1].start); // -(Duration of chunk 1)
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 5), ".m4s");
is(videosb.buffered.length, 1, "No discontinuity");
isfuzzy(videosb.buffered.start(0), vchunks[0].start, eps, "Chunk start");
isfuzzy(videosb.buffered.end(0), vchunks[0].end, eps, "Chunk end");
videosb.timestampOffset = firstvoffset;
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(5, 9), ".m4s");
is(videosb.buffered.length, 2, "One discontinuity");
isfuzzy(videosb.buffered.start(0), vchunks[0].start, eps, "First Chunk start");
@@ -44,17 +44,17 @@ runWithMSE(async (ms, el) => {
isfuzzy(videosb.buffered.start(1), vchunks[1].start + firstvoffset, eps, "Second chunk start");
isfuzzy(videosb.buffered.end(1), vchunks[1].end + firstvoffset, eps, "Second chunk end");
videosb.timestampOffset = secondvoffset;
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(9, 14), ".m4s");
is(videosb.buffered.length, 1, "No discontinuity (end)");
isfuzzy(videosb.buffered.start(0), vchunks[0].start, eps, "Chunk start");
isfuzzy(videosb.buffered.end(0), vchunks[2].end, eps, "Chunk end");
audiosb.timestampOffset = 3;
- await fetchAndLoad(audiosb, "bipbop/bipbop_audio", [ "init" ], ".mp4");
+ await fetchAndLoad(audiosb, "bipbop/bipbop_audio", ["init"], ".mp4");
await fetchAndLoad(audiosb, "bipbop/bipbop_audio", range(1, 12), ".m4s");
is(audiosb.buffered.length, 1, "No audio discontinuity");
isfuzzy(audiosb.buffered.start(0), 3, eps, "Audio starts at 3");
// Trim the rest of the audio.
audiosb.remove(videosb.buffered.end(0), Infinity);
videosb.remove(videosb.buffered.end(0), Infinity);
if (audiosb.updating) {
@@ -62,16 +62,16 @@ runWithMSE(async (ms, el) => {
}
if (videosb.updating) {
await once(videosb, "updateend");
}
info("waiting for play to complete");
el.play();
el.currentTime = el.buffered.start(0);
ms.endOfStream();
- await Promise.all([ once(el, "ended"), once(el, "seeked") ]);
+ await Promise.all([once(el, "ended"), once(el, "seeked")]);
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>
--- a/dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html
+++ b/dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html
@@ -15,22 +15,22 @@ runWithMSE(async (ms, el) => {
el.controls = true;
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
el.addEventListener("ended", function() {
ok(false, "ended should never fire");
SimpleTest.finish();
});
const videosb = ms.addSourceBuffer("video/mp4");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 5), ".m4s");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(6, 8), ".m4s");
is(el.buffered.length, 2, "discontinuous buffered range");
ms.endOfStream();
- await Promise.all([ once(el, "durationchange"), once(ms, "sourceended") ]);
+ await Promise.all([once(el, "durationchange"), once(ms, "sourceended")]);
// HTMLMediaElement fires "waiting" if somebody invokes |play()| before the MDSM
// has notified it of available data. Make sure that we get "playing" before
// we starting waiting for "waiting".
info("Invoking play()");
el.play();
await once(el, "playing");
ok(true, "Video playing. It should play for a bit, then fire 'waiting'");
await once(el, "waiting");
--- a/dom/media/mediasource/test/test_WaitingOnMissingData_mp4.html
+++ b/dom/media/mediasource/test/test_WaitingOnMissingData_mp4.html
@@ -12,20 +12,20 @@
SimpleTest.waitForExplicitFinish();
runWithMSE(async (ms, el) => {
el.controls = true;
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const audiosb = ms.addSourceBuffer("audio/mp4");
const videosb = ms.addSourceBuffer("video/mp4");
- await fetchAndLoad(audiosb, "bipbop/bipbop_audio", [ "init" ], ".mp4");
+ await fetchAndLoad(audiosb, "bipbop/bipbop_audio", ["init"], ".mp4");
await fetchAndLoad(audiosb, "bipbop/bipbop_audio", range(1, 5), ".m4s");
await fetchAndLoad(audiosb, "bipbop/bipbop_audio", range(6, 12), ".m4s");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 6), ".m4s");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(7, 14), ".m4s");
// HTMLMediaElement fires "waiting" if somebody invokes |play()| before the MDSM
// has notified it of available data. Make sure that we get "playing" before
// we starting waiting for "waiting".
info("Invoking play()");
let p = once(el, "playing");
el.play();
@@ -38,18 +38,18 @@ runWithMSE(async (ms, el) => {
// the next video frame, currentTime can be up to 1 frame's worth earlier than
// min(audioEnd, videoEnd).
// 0.0465 is the length of the last audio frame.
ok(el.currentTime >= (Math.min(audiosb.buffered.end(0), videosb.buffered.end(0)) - 0.0465),
`Got a waiting event at ${el.currentTime}`);
info("Loading more data");
p = once(el, "ended");
await Promise.all([
- fetchAndLoad(audiosb, "bipbop/bipbop_audio", [ 5 ], ".m4s"),
- fetchAndLoad(videosb, "bipbop/bipbop_video", [ 6 ], ".m4s")
+ fetchAndLoad(audiosb, "bipbop/bipbop_audio", [5], ".m4s"),
+ fetchAndLoad(videosb, "bipbop/bipbop_video", [6], ".m4s")
]);
ms.endOfStream();
await p;
// These fuzz factors are bigger than they should be. We should investigate
// and fix them in bug 1137574.
isfuzzy(el.duration, 10.1, 0.1, "Video has correct duration: " + el.duration);
isfuzzy(el.currentTime, el.duration, 0.1, "Video has correct currentTime.");
SimpleTest.finish();
--- a/dom/media/mediasource/test/test_WaitingToEndedTransition_mp4.html
+++ b/dom/media/mediasource/test/test_WaitingToEndedTransition_mp4.html
@@ -16,18 +16,18 @@ runWithMSE(async (ms, el) => {
await once(ms, "sourceopen");
ok(true, "Receive a sourceopen event");
const audiosb = ms.addSourceBuffer("audio/mp4");
const videosb = ms.addSourceBuffer("video/mp4");
// ensure tracks end at approximately the same time to ensure ended event is
// always fired (bug 1233639).
audiosb.appendWindowEnd = 3.9;
videosb.appendWindowEnd = 3.9;
- await fetchAndLoad(audiosb, "bipbop/bipbop_audio", [ "init" ], ".mp4");
- await fetchAndLoad(videosb, "bipbop/bipbop_video", [ "init" ], ".mp4");
+ await fetchAndLoad(audiosb, "bipbop/bipbop_audio", ["init"], ".mp4");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
await fetchAndLoad(audiosb, "bipbop/bipbop_audio", range(1, 5), ".m4s");
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 6), ".m4s");
// HTMLMediaElement fires "waiting" if somebody invokes |play()| before the MDSM
// has notified it of available data. Make sure that we get "playing" before
// we starting waiting for "waiting".
info("Invoking play()");
let p = once(el, "playing");
el.play();
--- a/dom/media/mediasource/test/test_WebMTagsBeforeCluster.html
+++ b/dom/media/mediasource/test/test_WebMTagsBeforeCluster.html
@@ -7,17 +7,17 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
-addMSEPrefs([ "media.mediasource.webm.enabled", true ]);
+addMSEPrefs(["media.mediasource.webm.enabled", true]);
runWithMSE(function(ms, v) {
ms.addEventListener("sourceopen", function() {
const sb = ms.addSourceBuffer("video/webm");
fetchWithXHR("tags_before_cluster.webm", async function(arrayBuffer) {
info("- append buffer -");
sb.appendBuffer(new Uint8Array(arrayBuffer));