зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1403478 - part1 : check v.seekable before and after calling ms.endOfStream(). r=jwwang,jya
This patch does two things, (1) check v.seekable after calling ms.endOfStream() As test name suggests, we check seekable after calling endOfStream() (2) check the time range of v.seekable The seekable represents the ranges of the media resource [1], so it would be changed after calling ms.endOfStream(). Before calling the endOfStream(), seekable should be [0, ms.duration) After calling the endOfStream(), seekable should be [0, ms.buffer.end(0)) [1] https://www.w3.org/TR/html51/semantics-embedded-content.html#dom-htmlmediaelement-seekable MozReview-Commit-ID: 56AIZYVsHhW --HG-- extra : rebase_source : a1f1df601dc8523cd5d4e58b41cada3c79d494c1
This commit is contained in:
Родитель
6d4428a710
Коммит
27e06f23ea
|
@ -16,22 +16,34 @@ runWithMSE(function (ms, v) {
|
|||
ms.addEventListener("sourceopen", function () {
|
||||
var sb = ms.addSourceBuffer("video/webm");
|
||||
|
||||
fetchWithXHR("seek.webm", function (arrayBuffer) {
|
||||
fetchWithXHR("seek.webm", async function (arrayBuffer) {
|
||||
info("- append buffer -");
|
||||
sb.appendBuffer(new Uint8Array(arrayBuffer));
|
||||
var promises = [];
|
||||
promises.push(once(sb, "updateend"));
|
||||
promises.push(once(v, "loadedmetadata"));
|
||||
Promise.all(promises).then(function () {
|
||||
ms.endOfStream();
|
||||
once(ms, "sourceended").then(function() {
|
||||
var target = 2;
|
||||
ok(v.seekable.length, "Resource is seekable");
|
||||
ok(v.seekable.length &&
|
||||
target >= v.seekable.start(0) &&
|
||||
target < v.seekable.end(0), "Target is within seekable range");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
||||
info("- wait for metadata -");
|
||||
await once(v, "loadedmetadata");
|
||||
|
||||
info("- wait for updateend -");
|
||||
await once(sb, "updateend");
|
||||
|
||||
info("- check seekable -");
|
||||
ok(v.seekable.length, "Resource is seekable");
|
||||
is(v.seekable.start(0), 0, "Seekable's start point is correct");
|
||||
is(v.seekable.end(0), ms.duration, "Seekable's end point is correct");
|
||||
|
||||
info("- call end of stream -");
|
||||
ms.endOfStream();
|
||||
await once(ms, "sourceended");
|
||||
|
||||
info("- check seekable -");
|
||||
var target = 2;
|
||||
ok(v.seekable.length, "Resource is seekable");
|
||||
is(v.seekable.start(0), 0, "Seekable's start point is correct");
|
||||
is(v.seekable.end(0), ms.duration, "Seekable's end point is correct");
|
||||
ok(v.seekable.length &&
|
||||
target >= v.seekable.start(0) &&
|
||||
target < v.seekable.end(0), "Target is within seekable range");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,29 +16,38 @@ runWithMSE(function (ms, v) {
|
|||
ms.addEventListener("sourceopen", function () {
|
||||
var sb = ms.addSourceBuffer("video/webm");
|
||||
|
||||
fetchWithXHR("seek.webm", function (arrayBuffer) {
|
||||
fetchWithXHR("seek.webm", async function (arrayBuffer) {
|
||||
info("- append first buffer -");
|
||||
// 25523 is the offset of the first media segment's end
|
||||
sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 25523));
|
||||
var updateCount = 0;
|
||||
sb.addEventListener("updateend", function () {
|
||||
updateCount++;
|
||||
if (updateCount == 1) {
|
||||
// 25523 is the offset of the first media segment's end
|
||||
sb.appendBuffer(new Uint8Array(arrayBuffer, 25523));
|
||||
}
|
||||
else if (updateCount == 2) {
|
||||
ms.endOfStream();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var target = 2;
|
||||
info("- wait for metadata -");
|
||||
await once(v, "loadedmetadata");
|
||||
|
||||
v.addEventListener("loadedmetadata", function () {
|
||||
info("- wait for updateend -");
|
||||
await once(sb, "updateend");
|
||||
|
||||
info("- append second buffer -");
|
||||
sb.appendBuffer(new Uint8Array(arrayBuffer, 25523));
|
||||
await once(sb, "updateend");
|
||||
|
||||
info("- check seekable -");
|
||||
ok(v.seekable.length, "Resource is seekable");
|
||||
is(v.seekable.start(0), 0, "Seekable's start point is correct");
|
||||
is(v.seekable.end(0), ms.duration, "Seekable's end point is correct");
|
||||
|
||||
info("- call end of stream -");
|
||||
ms.endOfStream();
|
||||
await once(ms, "sourceended");
|
||||
|
||||
info("- check seekable -");
|
||||
var target = 2;
|
||||
ok(v.seekable.length, "Resource is seekable");
|
||||
is(v.seekable.start(0), 0, "Seekable's start point is correct");
|
||||
is(v.seekable.end(0), ms.duration, "Seekable's end point is correct");
|
||||
ok(v.seekable.length &&
|
||||
target >= v.seekable.start(0) &&
|
||||
target < v.seekable.end(0), "Target is within seekable range");
|
||||
target >= v.seekable.start(0) &&
|
||||
target < v.seekable.end(0), "Target is within seekable range");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,29 +16,38 @@ runWithMSE(function (ms, v) {
|
|||
ms.addEventListener("sourceopen", function () {
|
||||
var sb = ms.addSourceBuffer("video/mp4");
|
||||
|
||||
fetchWithXHR("bipbop/bipbop2s.mp4", function (arrayBuffer) {
|
||||
fetchWithXHR("bipbop/bipbop2s.mp4", async function (arrayBuffer) {
|
||||
info("- append first buffer -");
|
||||
// 25819 is the offset of the first media segment's end
|
||||
sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 25819));
|
||||
var updateCount = 0;
|
||||
sb.addEventListener("updateend", function () {
|
||||
updateCount++;
|
||||
if (updateCount == 1) {
|
||||
// 25819 is the offset of the first media segment's end
|
||||
sb.appendBuffer(new Uint8Array(arrayBuffer, 25819));
|
||||
}
|
||||
else if (updateCount == 2) {
|
||||
ms.endOfStream();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var target = 1.3;
|
||||
info("- wait for metadata -");
|
||||
await once(v, "loadedmetadata");
|
||||
|
||||
v.addEventListener("loadedmetadata", function () {
|
||||
info("- wait for updateend -");
|
||||
await once(sb, "updateend");
|
||||
|
||||
info("- append second buffer -");
|
||||
sb.appendBuffer(new Uint8Array(arrayBuffer, 25819));
|
||||
await once(sb, "updateend");
|
||||
|
||||
info("- check seekable -");
|
||||
ok(v.seekable.length, "Resource is seekable");
|
||||
is(v.seekable.start(0), 0, "Seekable's start point is correct");
|
||||
is(v.seekable.end(0), ms.duration, "Seekable's end point is correct");
|
||||
|
||||
info("- call end of stream -");
|
||||
ms.endOfStream();
|
||||
await once(ms, "sourceended");
|
||||
|
||||
info("- check seekable -");
|
||||
var target = 1.3;
|
||||
ok(v.seekable.length, "Resource is seekable");
|
||||
is(v.seekable.start(0), 0, "Seekable's start point is correct");
|
||||
is(v.seekable.end(0), ms.duration, "Seekable's end point is correct");
|
||||
ok(v.seekable.length &&
|
||||
target >= v.seekable.start(0) &&
|
||||
target < v.seekable.end(0), "Target is within seekable range");
|
||||
target >= v.seekable.start(0) &&
|
||||
target < v.seekable.end(0), "Target is within seekable range");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,22 +16,34 @@ runWithMSE(function (ms, v) {
|
|||
ms.addEventListener("sourceopen", function () {
|
||||
var sb = ms.addSourceBuffer("video/mp4");
|
||||
|
||||
fetchWithXHR("bipbop/bipbop2s.mp4", function (arrayBuffer) {
|
||||
fetchWithXHR("bipbop/bipbop2s.mp4", async function (arrayBuffer) {
|
||||
info("- append buffer -");
|
||||
sb.appendBuffer(new Uint8Array(arrayBuffer));
|
||||
var promises = [];
|
||||
promises.push(once(sb, "updateend"));
|
||||
promises.push(once(v, "loadedmetadata"));
|
||||
Promise.all(promises).then(function () {
|
||||
ms.endOfStream();
|
||||
once(ms, "sourceended").then(function() {
|
||||
var target = 1.3;
|
||||
ok(v.seekable.length, "Resource is seekable");
|
||||
ok(v.seekable.length &&
|
||||
target >= v.seekable.start(0) &&
|
||||
target < v.seekable.end(0), "Target is within seekable range");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
||||
info("- wait for metadata -");
|
||||
await once(v, "loadedmetadata");
|
||||
|
||||
info("- wait for updateend -");
|
||||
await once(sb, "updateend");
|
||||
|
||||
info("- check seekable -");
|
||||
ok(v.seekable.length, "Resource is seekable");
|
||||
is(v.seekable.start(0), 0, "Seekable's start point is correct");
|
||||
is(v.seekable.end(0), ms.duration, "Seekable's end point is correct");
|
||||
|
||||
info("- call end of stream -");
|
||||
ms.endOfStream();
|
||||
await once(ms, "sourceended");
|
||||
|
||||
info("- check seekable -");
|
||||
var target = 1.3;
|
||||
ok(v.seekable.length, "Resource is seekable");
|
||||
is(v.seekable.start(0), 0, "Seekable's start point is correct");
|
||||
is(v.seekable.end(0), ms.duration, "Seekable's end point is correct");
|
||||
ok(v.seekable.length &&
|
||||
target >= v.seekable.start(0) &&
|
||||
target < v.seekable.end(0), "Target is within seekable range");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче