var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
    if (!privateMap.has(receiver)) {
        throw new TypeError("attempted to get private field on non-instance");
    }
    return privateMap.get(receiver);
};
var _server;
import { h } from "@stencil/core";
export class BceElementVideo {
    constructor() {
        // @State()
        // private youtube = false;
        _server.set(this, window.BCE.file);
    }
    // private createYouTubeURL(id: string) {
    //   const url = this.template && new URL(this.template.location);
    //   const path = 'https://www.youtube.com/embed/' + id;
    //   const start = (url && url.searchParams.get('t')) || 0;
    //   const autoplay = this.template && this.template.autoplay;
    //   return `${path}?start=${start}&autoplay=${autoplay}`;
    // }
    // renderYouTube() {
    //   return [
    //     <img src="http://placehold.it/16x9" />,
    //     <iframe src={this.url} frameborder="0" allowFullScreen />
    //   ];
    // }
    render() {
        if (!this.template)
            return;
        const { autoplay } = this.template;
        return this.template.location.map(id => {
            const file = __classPrivateFieldGet(this, _server).get(id);
            return (file && (h("video", { key: id, autoplay: autoplay, muted: autoplay, playsInline: autoplay, controls: true },
                h("source", { src: file.url, type: file.type }))));
        });
    }
    static get is() { return "bce-element-video"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() { return {
        "$": ["bce-element-video.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["bce-element-video.css"]
    }; }
    static get properties() { return {
        "handler": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "InputHandler",
                "resolved": "InputHandler",
                "references": {
                    "InputHandler": {
                        "location": "import",
                        "path": "../../../utils/input-handler"
                    }
                }
            },
            "required": true,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            }
        },
        "language": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string | undefined",
                "references": {}
            },
            "required": false,
            "optional": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "language",
            "reflect": false
        },
        "template": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "VideoElement",
                "resolved": "VideoElement | undefined",
                "references": {
                    "VideoElement": {
                        "location": "import",
                        "path": "./element-video"
                    }
                }
            },
            "required": false,
            "optional": true,
            "docs": {
                "tags": [],
                "text": ""
            }
        }
    }; }
}
_server = new WeakMap();
