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 video sources on the current system using the getSources API.
10 * This does not guarantee that a getUserMedia with video will succeed, as the
11 * camera could be busy for instance.
13 * Returns has-video-source to the test if there is a webcam available,
14 * no-video-sources otherwise.
16 function HasVideoSourceOnSystem() {
17 MediaStreamTrack.getSources(function(sources) {
18 var hasVideoSource = false;
19 sources.forEach(function(source) {
20 if (source.kind == 'video')
21 hasVideoSource = true;
25 returnToTest('has-video-source');
27 returnToTest('no-video-sources');