blob: 54f683589d5ab09aa56166061420cc43e6aedbf9 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src=media-file.js></script>
<script src=video-test.js></script>
<script src='../resources/ui-helper.js'></script>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
function finish()
{
video.removeEventListener("ended", finish);
video.currentTime = 0;
waitForEvent('playing');
waitForEventAndEnd('seeked');
video.play();
video.currentTime = video.duration - 0.05;
}
function playing()
{
video.removeEventListener("playing", playing);
video.addEventListener("ended", finish);
video.currentTime = video.duration - 0.05;
}
function inputFileChanged(e) {
findMediaElement();
var file = e.target.files[0];
video.src = window.URL.createObjectURL(file);
video.addEventListener("playing", playing);
video.play();
}
function runTest() {
var inputFile = document.getElementById('file');
var centerX = inputFile.offsetLeft + inputFile.offsetWidth / 2;
var centerY = inputFile.offsetTop + inputFile.offsetHeight / 2;
waitForEvent('change', inputFileChanged, false, false, inputFile);
if (window.testRunner) {
testRunner.setOpenPanelFiles([findMediaFile("video", "content/test")]);
UIHelper.activateAt(centerX, centerY);
}
}
</script>
</head>
<body onload="runTest()">
<div>
This tests the ability of the &lt;video&gt; element to load blob URLs, play to the end, and replay. In the browser, select a video file:
<input type="file" name="file" id="file">
</div>
<video></video>
</body>
</html>