"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const event_target_shim_1 = require("event-target-shim");
const react_native_1 = require("react-native");
const getDisplayMedia_1 = __importDefault(require("./getDisplayMedia"));
const getUserMedia_1 = __importDefault(require("./getUserMedia"));
const { WebRTCModule } = react_native_1.NativeModules;
const MEDIA_DEVICES_EVENTS = ['devicechange'];
class MediaDevices extends event_target_shim_1.defineCustomEventTarget(...MEDIA_DEVICES_EVENTS) {
    /**
     * W3C "Media Capture and Streams" compatible {@code enumerateDevices}
     * implementation.
     */
    enumerateDevices() {
        return new Promise(resolve => WebRTCModule.enumerateDevices(resolve));
    }
    /**
     * W3C "Screen Capture" compatible {@code getDisplayMedia} implementation.
     * See: https://w3c.github.io/mediacapture-screen-share/
     *
     * @returns {Promise}
     */
    getDisplayMedia() {
        return getDisplayMedia_1.default();
    }
    /**
     * W3C "Media Capture and Streams" compatible {@code getUserMedia}
     * implementation.
     * See: https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-enumeratedevices
     *
     * @param {*} constraints
     * @returns {Promise}
     */
    getUserMedia(constraints) {
        return getUserMedia_1.default(constraints);
    }
}
exports.default = new MediaDevices();
//# sourceMappingURL=MediaDevices.js.map