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