Custom Media Element
A custom element for extending the native media elements (<audio>
or <video>
).
Usage
import { CustomVideoElement } from 'custom-media-element';
class MyCustomVideoElement extends CustomVideoElement {
constructor() {
super();
}
play() {
return super.play()
}
get src() {
return super.src;
}
set src(src) {
super.src = src;
}
}
if (globalThis.customElements && !globalThis.customElements.get('my-custom-video')) {
globalThis.customElements.define('my-custom-video', MyCustomVideoElement);
}
export default MyCustomVideoElement;
<my-custom-video
src="https://stream.mux.com/A3VXy02VoUinw01pwyomEO3bHnG4P32xzV7u1j1FSzjNg/low.mp4"
></my-custom-video>
Related