OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <title>getUserMedia({video:true}) creates a stream with a properly initialized v
ideo track</title> | |
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#id
l-def-MediaStreamTrack"> | |
7 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#li
fe-cycle-and-media-flow"> | |
8 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#wi
dl-MediaStreamTrack-kind"> | |
9 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#wi
dl-MediaStreamTrack-enabled"> | |
10 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#wi
dl-MediaStreamTrack-readyState"> | |
11 </head> | |
12 <body> | |
13 <p class="instructions">When prompted, accept to share your video stream.</p> | |
14 <h1 class="instructions">Description</h1> | |
15 <p class="instructions">This test checks that the video track of MediaStream | |
16 object returned by the success callback in getUserMedia is correctly initialized
.</p> | |
17 | |
18 <div id='log'></div> | |
19 <script src=/resources/testharness.js></script> | |
20 <script src=/resources/testharnessreport.js></script> | |
21 <script src=/resources/WebIDLParser.js></script> | |
22 <script src=/resources/idlharness.js></script> | |
23 <script src="/common/vendor-prefix.js" data-prefixed-objects='[{"ancestors":["na
vigator"], "name":"getUserMedia"}]'></script> | |
24 <script> | |
25 var t = async_test("Tests that the video MediaStreamTrack objects are properly i
nitialized", {timeout:10000}); | |
26 var track = null | |
27 var idl_array = new IdlArray(); | |
28 | |
29 idl_array.add_idls("interface EventTarget {\ | |
30 void addEventListener(DOMString type, EventListener? callback, optional boolea
n capture = false);\ | |
31 void removeEventListener(DOMString type, EventListener? callback, optional boo
lean capture = false);\ | |
32 boolean dispatchEvent(Event event);\ | |
33 };"); | |
34 | |
35 idl_array.add_idls("interface MediaStreamTrack : EventTarget {\ | |
36 readonly attribute DOMString kind;\ | |
37 readonly attribute DOMString id;\ | |
38 readonly attribute DOMString label;\ | |
39 attribute boolean enabled;\ | |
40 readonly attribute boolean muted;\ | |
41 attribute EventHandler onmute;\ | |
42 attribute EventHandler onunmute;\ | |
43 readonly attribute boolean _readonly;\ | |
44 readonly attribute boolean remote;\ | |
45 readonly attribute MediaStreamTrackState readyState;\ | |
46 attribute EventHandler onended;\ | |
47 attribute EventHandler onoverconstrained;\ | |
48 MediaStreamTrack clone ();\ | |
49 void stop ();\ | |
50 MediaTrackCapabilities getCapabilities ();\ | |
51 MediaTrackConstraints getConstraints ();\ | |
52 MediaTrackSettings getSettings ();\ | |
53 Promise<void> applyConstraints (optional MediaTrackConstraints cons
traints);\ | |
54 };"); | |
55 | |
56 t.step(function () { | |
57 navigator.getUserMedia({video: true}, t.step_func(function (stream) { | |
58 var videoTracks = stream.getVideoTracks(); | |
59 assert_equals(videoTracks.length, 1, "There is exactly one video track in th
e media stream"); | |
60 track = videoTracks[0]; | |
61 idl_array.add_objects({MediaStreamTrack: ["track"]}); | |
62 idl_array.test(); | |
63 assert_equals(track.readyState, "live", "The track object is in live state")
; | |
64 assert_equals(track.kind, "video", "The track object is of video kind"); | |
65 // Not clear that this is required by the spec, | |
66 // see https://www.w3.org/Bugs/Public/show_bug.cgi?id=22212 | |
67 assert_true(track.enabled, "The track object is enabed"); | |
68 t.done(); | |
69 }), function (error) {}); | |
70 }); | |
71 </script> | |
72 </body> | |
73 </html> | |
OLD | NEW |