2023-06-06 23:24:30 +02:00
|
|
|
/* eslint-env browser */
|
|
|
|
import videojs from '../../../src/js/video.js';
|
|
|
|
|
|
|
|
export class TestCustomElement extends HTMLElement {
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
|
|
|
|
const shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
|
|
|
|
|
|
const containerElem = document.createElement('div');
|
|
|
|
|
|
|
|
containerElem.setAttribute('data-vjs-player', '');
|
|
|
|
shadowRoot.appendChild(containerElem);
|
|
|
|
|
|
|
|
const videoElem = document.createElement('video');
|
|
|
|
|
|
|
|
videoElem.setAttribute('width', 640);
|
|
|
|
videoElem.setAttribute('height', 260);
|
|
|
|
containerElem.appendChild(videoElem);
|
|
|
|
|
|
|
|
this.innerPlayer = videojs(videoElem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-03 13:23:30 +01:00
|
|
|
export class TestSlotElement extends HTMLElement {
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
const shadowRoot = this.attachShadow({ mode: 'open' });
|
|
|
|
const wrapperEl = document.createElement('div');
|
|
|
|
|
|
|
|
wrapperEl.style = this.dataset.style;
|
|
|
|
const slot = document.createElement('slot');
|
|
|
|
|
|
|
|
wrapperEl.appendChild(slot);
|
|
|
|
shadowRoot.appendChild(wrapperEl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-12 19:43:17 +02:00
|
|
|
// Not supported on Chrome < 54
|
|
|
|
if ('customElements' in window) {
|
|
|
|
window.customElements.define('test-custom-element', TestCustomElement);
|
2024-05-03 13:23:30 +01:00
|
|
|
window.customElements.define('test-slot-element', TestSlotElement);
|
2023-07-12 19:43:17 +02:00
|
|
|
}
|