OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <title>getUserMedia({video:true}) creates a stream with ended set to false</titl
e> | |
5 <link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/> | |
6 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#wi
dl-MediaStream-ended"> | |
7 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#ev
ent-mediastream-ended"> | |
8 <link rel='stylesheet' href='../../../../../resources/testharness.css' media='al
l'/> | |
9 </head> | |
10 <body> | |
11 <p class="instructions" style="display:none">When prompted, accept to share your
video stream.</p> | |
12 <h1 class="instructions" style="display:none">Description</h1> | |
13 <p class="instructions" style="display:none">This test checks that the MediaStre
am object returned by | |
14 the success callback in getUserMedia has a ended set to false at start, and | |
15 triggers "onended" when it is set to true.</p> | |
16 | |
17 <div id='log'></div> | |
18 <script src=../../../../../resources/testharness.js></script> | |
19 <script src=../../../../../resources/testharnessreport.js></script> | |
20 <script src="../../../../../resources/vendor-prefix.js" data-prefixed-objects='[
{"ancestors":["navigator"], "name":"getUserMedia"}]'></script> | |
21 <script> | |
22 var t = async_test("Tests that a MediaStream handles ended correctly", {timeout:
10000}); | |
23 t.step(function () { | |
24 navigator.getUserMedia({video:true}, t.step_func(function (stream) { | |
25 assert_true(!stream.ended, "the media stream starts with ended set to false"
); | |
26 stream.addEventListener("ended", t.step_func(function() { | |
27 assert_true(stream.ended, "stream.ended now set to true"); | |
28 t.done(); | |
29 }), false); | |
30 stream.ended = true; | |
31 assert_true(!stream.ended, "stream.ended should remain false"); | |
32 stream.getVideoTracks()[0].stop(); | |
33 }), function (error) {}); | |
34 }); | |
35 </script> | |
36 </body> | |
37 </html> | |
OLD | NEW |