getUserMedia now returns a single track per type/source, and is available through getVideoTracks()
authorDominique Hazael-Massieux <dom@w3.org>
Thu, 30 May 2013 15:19:52 +0200
changeset 34 cd4a06432643
parent 33 64a5c78e735b
child 35 1b6234f7c7c9
getUserMedia now returns a single track per type/source, and is available through getVideoTracks()
submitted/W3C/mediastreamtrack-init.html
--- a/submitted/W3C/mediastreamtrack-init.html	Thu May 30 14:14:51 2013 +0200
+++ b/submitted/W3C/mediastreamtrack-init.html	Thu May 30 15:19:52 2013 +0200
@@ -20,13 +20,13 @@
 var t = async_test("Tests that the video MediaStreamTrack objects are properly initialized");
 t.step(function () {
   navigator.getUserMedia({video: true}, t.step_func(function (stream) {
-    for (var i = 0 ; i < stream.videoTracks.length ; i++) {
-      var track = stream.videoTracks[i];
-      assert_true(track instanceof MediaStreamTrack, "The track object #" + i + " is an instance of MediaStreamTrack");
-      assert_equals(track.readyState, track.LIVE, "The track object #" + i + " is in live state");
-      assert_equals(track.kind, "video", "The track object #" + i + " is of video kind");
-      assert_true(track.enabled, "The track object #" + i + " is enabed"); // Not clear that this is required by the spec
-    }
+    var videoTracks = stream.getVideoTracks();
+    assert_equals(videoTracks.length, 1, "There is exactly one video track in the media stream");
+    var track = videoTracks[0];
+    assert_true(track instanceof MediaStreamTrack, "The track object is an instance of MediaStreamTrack");
+    assert_equals(track.readyState, track.LIVE, "The track object is in live state");
+      assert_equals(track.kind, "video", "The track object is of video kind");
+      assert_true(track.enabled, "The track object is enabed"); // Not clear that this is required by the spec    
     t.done();
   }));
 });