2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
8 * Queries for media devices on the current system using the getMediaDevices
11 * Returns the list of devices available.
13 function getMediaDevices() {
14 navigator
.getMediaDevices(function(devices
) {
15 returnToTest(JSON
.stringify(devices
));
20 * Queries for media sources on the current system using the getSources API.
22 * Returns the list of sources available.
24 function getSources() {
25 MediaStreamTrack
.getSources(function(sources
) {
26 returnToTest(JSON
.stringify(sources
));
31 * Queries for video input devices on the current system using the
34 * This does not guarantee that a getUserMedia with video will succeed, as the
35 * camera could be busy for instance.
37 * Returns has-video-input-device to the test if there is a webcam available,
38 * no-video-input-devices otherwise.
40 function hasVideoInputDeviceOnSystem() {
41 MediaStreamTrack
.getSources(function(devices
) {
42 var hasVideoInputDevice
= false;
43 devices
.forEach(function(device
) {
44 if (device
.kind
== 'video')
45 hasVideoInputDevice
= true;
48 if (hasVideoInputDevice
)
49 returnToTest('has-video-input-device');
51 returnToTest('no-video-input-devices');