mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1843003 - Test that typical mp3 broadcast work well. r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D183737
This commit is contained in:
parent
df3b999195
commit
087c0aa2e1
@ -783,6 +783,10 @@ support-files =
|
||||
hls/960x720_seg0.ts
|
||||
hls/960x720_seg1.ts
|
||||
sync.webm
|
||||
two-xing-header-no-content-length.mp3
|
||||
two-xing-header-no-content-length.mp3^headers^
|
||||
single-xing-header-no-content-length.mp3
|
||||
single-xing-header-no-content-length.mp3^headers^
|
||||
|
||||
[test_capture_stream_av_sync.html]
|
||||
skip-if =
|
||||
@ -885,3 +889,4 @@ tags = cloneelementvisually
|
||||
tags = cloneelementvisually
|
||||
[test_cloneElementVisually_ended_video.html]
|
||||
tags = cloneelementvisually
|
||||
[test_mp3_broadcast.html]
|
||||
|
BIN
dom/media/test/single-xing-header-no-content-length.mp3
Normal file
BIN
dom/media/test/single-xing-header-no-content-length.mp3
Normal file
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
HTTP 200 OK
|
||||
Content-Length: invalid
|
||||
Cache-Control: no-store
|
52
dom/media/test/test_mp3_broadcast.html
Normal file
52
dom/media/test/test_mp3_broadcast.html
Normal file
@ -0,0 +1,52 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Test playback of broadcast-like streams</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<audio controls id=a style="width: 100%;"></audio>
|
||||
<script type="module">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const streams = [
|
||||
// An mp3 bytestream consisting of a complete mp3 file with a XING
|
||||
// header, that has duration information, but served without a
|
||||
// `Content-Length`. It is followed by a second mp3 bytestream that
|
||||
// also has a XING header. While some software are able to play the
|
||||
// entire file, Web browser don't.
|
||||
{ src: "two-xing-header-no-content-length.mp3", duration: 1 },
|
||||
// An mp3 bytestream consisting of a complete mp3 file with a XING
|
||||
// header, that has duration information, but served without a
|
||||
// `Content-Length` header. It is followed by a second mp3 bytestream that
|
||||
// doesn't have a XING header.
|
||||
// This scenario is typical in radio broadcast scenario, when the
|
||||
// live-stream has a pre-recorded prelude. The reported duration,
|
||||
// after "ended" has been received, is the duration of playback.
|
||||
{ src: "single-xing-header-no-content-length.mp3", duration: 11.030997 },
|
||||
];
|
||||
var audio = window.a;
|
||||
// Prevent ESLint error about top-level await
|
||||
(async function () {
|
||||
for (let i of streams) {
|
||||
audio.src = i.src;
|
||||
audio.load();
|
||||
audio.play();
|
||||
audio.onerror = (e) => {
|
||||
ok(false, `${i}: error: ${e.message}}`);
|
||||
};
|
||||
await once(audio, "ended");
|
||||
ok(true, `${i}: playback through the end`);
|
||||
is(audio.duration, i.duration, "Duration at end is correct");
|
||||
is(audio.currentTime, i.duration, "Current time at end is correct");
|
||||
}
|
||||
SimpleTest.finish();
|
||||
})()
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
BIN
dom/media/test/two-xing-header-no-content-length.mp3
Normal file
BIN
dom/media/test/two-xing-header-no-content-length.mp3
Normal file
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
HTTP 200 OK
|
||||
Content-Length: invalid
|
||||
Cache-Control: no-store
|
Loading…
Reference in New Issue
Block a user