"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Element_1 = require("../../../../../Class/Element");
const _ids_1 = require("../../../../_ids");
const globalComponent_1 = require("../../../../globalComponent");
class Video extends Element_1.Element_ {
    constructor(system) {
        super({
            i: ['src', 'stream', 'style', 'controls', 'currentTime', 'attr'],
            o: [],
        }, {
            input: {
                stream: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_VIDEO);
        this.__ = [...this.__, 'CS', 'PS', 'IM', 'ME'];
        this._defaultState = {};
    }
    async captureStream({ frameRate, }) {
        const firstLocalComponent = await (0, globalComponent_1.firstGlobalComponentPromise)(this.__system, this.__global_id);
        if (firstLocalComponent) {
            return firstLocalComponent.$element.captureStream({ frameRate });
        }
    }
    async image() {
        const localComponent = await (0, globalComponent_1.firstGlobalComponentPromise)(this.__system, this.__global_id);
        return localComponent.$element;
    }
    async requestPictureInPicture() {
        const localComponent = (await (0, globalComponent_1.firstGlobalComponentPromise)(this.__system, this.__global_id));
        return localComponent.requestPictureInPicture();
    }
    mediaPlay() {
        this.emit('call', { method: 'play', data: [] });
    }
    mediaPause() {
        this.emit('call', { method: 'pause', data: [] });
    }
}
exports.default = Video;
//# sourceMappingURL=index.js.map