// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// The spec for MediaDevices is in two parts:
// http://w3c.github.io/mediacapture-main/#mediadevices
// http://w3c.github.io/mediacapture-main/#mediadevices-interface-extensions

[
    ActiveScriptWrappable,
    DependentLifetime,
    ConstructorCallWith=ExecutionContext,
    RuntimeEnabled=MediaDevices
]
interface MediaDevices : EventTarget {
    [CallWith=ScriptState, MeasureAs=MediaDevicesEnumerateDevices] Promise<sequence<MediaDeviceInfo>> enumerateDevices();
    [RuntimeEnabled=MediaConstraints] MediaTrackSupportedConstraints getSupportedConstraints();
    [RuntimeEnabled=GetUserMedia,
     CallWith=ScriptState,
     RaisesException,
     MeasureAs=GetUserMediaPromise
    ] Promise<MediaStream> getUserMedia(MediaStreamConstraints options);
    [RuntimeEnabled=OnDeviceChange] attribute EventHandler ondevicechange;
};
