Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html>
<meta charset="utf-8">
<title>Fragmented MP4 Play to End</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<video id="video"
src="/media-source/mp4/test-v-128k-320x240-24fps-8kfr.mp4"
type="video/mp4; codecs=avc1.64000D"
controls
</video>
</body>
<script>
// Test that a fragmented mp4 can be played until the end without error.
promise_test(async t => {
const type = video.getAttribute('type');
const canPlay = video.canPlayType(type);
// must return "probably" if the user agent is confident that the type
// represents a media resource that it can render if used in with this audio
// or video element;
assert_implements_optional(
canPlay == 'probably',
`Test needs canPlayType('${type}') == 'probably'; got '${canPlay}'.`);
video.watcher = new EventWatcher(t, video,
['error', 'seeked', 'playing', 'ended']);
// Shorten test.
video.currentTime = 1.9;
await video.watcher.wait_for('seeked');
await Promise.all([
video.play(),
video.watcher.wait_for(['playing','ended']),
]);
}, 'fragmented-mp4-end');
</script>