mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
fc66ef3b4b
--HG-- extra : rebase_source : d84a07bc61144b7ab88e217bf9e5b815d273fb88
49 lines
1.2 KiB
HTML
49 lines
1.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Media test: play() method</title>
|
|
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
<pre id="test">
|
|
<video id="v" onerror="event.stopPropagation();"></video>
|
|
<script>
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
var v = document.getElementById("v");
|
|
|
|
var tokens = {
|
|
0: ["play"],
|
|
"play": ["canplay"],
|
|
"canplay": ["playing"],
|
|
"playing": ["canplay", "canplaythrough"],
|
|
"canplaythrough": ["canplay", "canplaythrough"]
|
|
};
|
|
|
|
var state = 0;
|
|
|
|
function gotPlayEvent(event) {
|
|
ok(tokens[state].indexOf(event.type) >= 0, "Check expected event got " + event.type + " at " + state);
|
|
state = event.type;
|
|
}
|
|
|
|
["play", "canplay", "playing", "canplaythrough"].forEach(function (e) {
|
|
v.addEventListener(e, gotPlayEvent, false);
|
|
});
|
|
|
|
function ended() {
|
|
is(state, "canplaythrough", "Last event should be canplaythrough");
|
|
SimpleTest.finish();
|
|
}
|
|
v.addEventListener("ended", ended, false);
|
|
|
|
v.src = "320x240.ogv";
|
|
v.load();
|
|
v.play();
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|