Source: media/player/UiVideoPlayer.js

import { UiElement } from "../../ui/UiElement.js";
import { VideoJSPlayer } from "./VideoJSPlayer.js";
export { UiVideoPlayer }

/**
 * Video player class using Shaka Player.
 * @extends UiElement
 * @author ckraemme <ckraemme@awi.de>
 
 */
class UiVideoPlayer extends UiElement {
    /**
     * Build a video player based on Shaka Player and include it to a target element.
     * @param {string/HTMLElement} target - HTML target element.
     * @param {Object.<string, Array>} options - Dictionary with input configuration for the player. The configuration can be set for the keys media, thumbnail, cover and poster. They contain the respective urls. If media is a list, the player will try to play the next item if the previous ones failed.
     * <pre>
     * Example:
     * const options = {
            'media': ['https://.../stream/master.mpd', 'https://.../stream/master.m3u8'],
            'thumbnail': 'https://.../thumbnail/master.vtt',
            'cover': 'https://.../cover/image.webp,
            'poster': 'https://.../poster/image.jpg',
        }
     * </pre>
     */
    constructor(target, options) {
        super(target);
        const uiElementContainer = this.getElement();
        uiElementContainer.classList.add("video-player");
        const videoPlayerContainer = document.createElement('div');
        videoPlayerContainer.className = "video-player-container";
        uiElementContainer.appendChild(videoPlayerContainer);

        this.videoPlayer_ = new VideoJSPlayer(videoPlayerContainer, options);
        //this.videoPlayer_ = new ShakaPlayer(videoPlayerContainer, options);
    }

    /**
     * Remove the video player completely.
     */
    dispose() {
        super.dispose();
        delete this.videoPlayer_;
        return null;
    }

}