"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const events_1 = require("events");
const debugDecorator_1 = require("../Debug/debugDecorator");
const coordinationsHelper_1 = require("../Dimensions/coordinationsHelper");
const AppletVideoError_1 = __importDefault(require("../Error/AppletVideoError"));
const ErrorCodes_1 = __importDefault(require("../Error/ErrorCodes"));
const ErrorSuggestions_1 = __importDefault(require("../Error/ErrorSuggestions"));
const SosError_1 = __importDefault(require("../Error/SosError"));
const Validate_1 = __importDefault(require("../Validate/Validate"));
const IVideoEvent_1 = require("./IVideoEvent");
const DEBUG_NAMESPACE = '@signageos/front-applet:FrontApplet:Video';
/**
 * We know how crucial video is for digital signage. So we made it easy. This guide will walk you through playing video using the sos.video API. This allows you to play video natively on any platform.
 *
 * The `sos.video` provides you 4 methods to handle the playback:
 * - `prepare()` - Prepare will load the video into memory and prepare it for immediate playback.
 * - `play()` - This method loads the video into memory (if it hasn't been loaded previously) and starts the video playback.
 * - `pause()` / `resume()` - This method pauses the video that was previously started to play, it is possible to resume the playback with `resume()`.
 * - `stop()` - This method stops the playback and unloads the video from memory.
 *
 * :::warning Video identification
 * First 5 parameters (uri, x, y, width, and height) are unique identifiers for playing the video using play, stop, resume, and pause methods.
 * :::
 *
 * <details>
 *     <summary>Device Video Capabilities</summary>
 * 		| Capability | Description |
 * 		|:------------|:-------------|
 * 		| `VIDEO_4K` | If device supports playing 4k videos |
 *
 * 		If you want to check if the device supports this capability, use [`sos.display.supports()`](https://developers.signageos.io/sdk/sos/display#supports).
 * </details>
 *
 * ## Gapless video playback
 * It is often desirable to be able to play different videos consecutively without "black" frames. To achieve this next video in the queue needs to be loaded before the current video ends. How to achieve this may differ from platform to platform. Applet JS SDK handles this under the hood and provides you with `prepare()`, `play()` and `stop()` methods.
 * Each video has to be pre-loaded with `prepare()` while the previous video is still playing, and after the video ends it should be unloaded immediately with `stop()`. This is because some (especially older ones) platforms support that only 2 videos are loaded into memory at any time (one playing and one ready to play).
 *
 * ![](https://docs.signageos.io/hc/article_attachments/9093558407708)
 *
 * @example
 * const { filePath } = await sos.offline.cache.loadOrSaveFile(
 *  'video-1.mp4',
 *  'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4',
 * );
 *
 * const video = [filePath, 0, 0, 1280, 720];
 *
 * await sos.video.play(...video);
 *
 * // pause the video after 2s
 * setTimeout(() => sos.video.pause(...video), 2000);
 *
 * // resume the paused video
 * setTimeout(() => sos.video.resume(...video), 2500);
 *
 * // stop and unload the video
 * setTimeout(() => sos.video.stop(...video), 4000);
 */
class Video {
    messagePrefix;
    postMessage;
    static MESSAGE_PREFIX = 'video';
    eventEmitter;
    onceDeferredIndex = {};
    /** @internal */
    constructor(messagePrefix, postMessage) {
        this.messagePrefix = messagePrefix;
        this.postMessage = postMessage;
        this.eventEmitter = new events_1.EventEmitter();
    }
    /**
     * The `play()` method starts the playback of a video or video that has been previously prepared by the `prepare()` method.
     *
     * @param uri Address to remote (online) or local video file
     * @param x x-position for video on screen
     * @param y y-position for video on screen
     * @param width Video width on screen
     * @param height Video height on screen
     * @throws Error If the parameters are not valid.
     * @throws Error If any error occurs during the playback of the video.
     * @returns {Promise<void>} Returns a promise that resolves when the video starts playing.
     * @since 1.0.3
     *
     * @example // {@link https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/video-loop-one | Play one video in infinite loop}
     * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/video-multiple | Play multiple videos in infinite loop}
     * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/video-and-images | Switching video and images in infinite loop}
     *
     * @example
     * const { filePath } = await sos.offline.cache.loadOrSaveFile('fileName', 'https://example.com/video.mp4');
     * const video = [filePath, 0, 0, 1920, 1080];
     * // Play the video
     * await sos.video.play(...video);
     */
    async play(uri, x, y, width, height) {
        this.checkParamsValidity(uri, x, y, width, height);
        ({ x, y, width, height } = (0, coordinationsHelper_1.sanitizeCoordinations)({ x, y, width, height }));
        this.removeAllVideoListeners(uri, x, y, width, height); // If not explicitly stopped and played again the same video
        const onceEndedDeferred = this.createOncePromise('ended', uri, x, y, width, height);
        const onceStopDeferred = this.createOncePromise('stop', uri, x, y, width, height);
        await this.postMessage({
            type: this.getMessage('play'),
            uri,
            x,
            y,
            width,
            height,
        });
        const srcArgumentsString = (0, IVideoEvent_1.stringifySrcArguments)(uri, x, y, width, height);
        this.onceDeferredIndex[srcArgumentsString] = {
            ended: onceEndedDeferred,
            stop: onceStopDeferred,
        };
        this.createAndEmitEvent('play', uri, x, y, width, height);
    }
    /**
     * The `prepare()` method loads the video into memory and prepares it for a playback, this is useful for gapless playback.
     *
     * @param uri Address to remote (online) or local video file
     * @param x x-position for video on screen
     * @param y y-position for video on screen
     * @param width Video width on screen
     * @param height Video height on screen
     * @param options Optional options for preparing the video.
     * @param options.background If view should be prepared in background.
     * @param options.volume Initial volume value of the video.
     * @throws Error If the parameters are not valid.
     * @throws Error If any error occurs during the preparation of the video.
     * @returns {Promise<void>} Returns a promise which resolves when the video is prepared.
     * @since 1.0.3
     *
     * @example
     * // Example of preparing and playing a video
     * const { filePath } = await sos.offline.cache.loadOrSaveFile('video-1.mp4', 'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4');
     * const video = [filePath, 0, 0, 1920, 1080];
     * // Prepare the video
     * await sos.video.prepare(...video);
     * // Play the video
     * await sos.video.play(...video);
     */
    async prepare(uri, x, y, width, height, options = {}) {
        this.checkParamsValidity(uri, x, y, width, height);
        ({ x, y, width, height } = (0, coordinationsHelper_1.sanitizeCoordinations)({ x, y, width, height }));
        await this.postMessage({
            type: this.getMessage('prepare'),
            uri,
            x,
            y,
            width,
            height,
            options,
        });
        this.createAndEmitEvent('prepare', uri, x, y, width, height);
    }
    /**
     * The `stop()` method stops the video; it can't be resumed with the `resume()` method.
     *
     * @param uri Address to remote (online) or local video file
     * @param x x-position for video on screen
     * @param y y-position for video on screen
     * @param width Video width on screen
     * @param height Video height on screen
     * @returns {Promise<void>} Returns a promise which resolves when the video is stopped.
     * @throws Error If the parameters are not valid.
     * @throws Error If any error occurs during the stopping of the video.
     * @since 1.0.3
     *
     * @example
     * // Example of stopping a video
     * const { filePath } = await sos.offline.cache.loadOrSaveFile('video-1.mp4', 'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4');
     * const video = [filePath, 0, 0, 1920, 1080];
     * // Prepare and play the video
     * await sos.video.prepare(...video);
     * await sos.video.play(...video);
     * // Stop the video after 5 seconds
     * setTimeout(() => sos.video.stop(...video), 5000);
     */
    async stop(uri, x, y, width, height) {
        this.checkParamsValidity(uri, x, y, width, height);
        ({ x, y, width, height } = (0, coordinationsHelper_1.sanitizeCoordinations)({ x, y, width, height }));
        await this.postMessage({
            type: this.getMessage('stop'),
            uri,
            x,
            y,
            width,
            height,
        });
        this.createAndEmitEvent('stop', uri, x, y, width, height);
        const srcArgumentsString = (0, IVideoEvent_1.stringifySrcArguments)(uri, x, y, width, height);
        this.onceDeferredIndex[srcArgumentsString]?.ended.reject?.(new AppletVideoError_1.default({
            kind: 'appletVideoError',
            message: `This video was stopped already. The arguments: ${srcArgumentsString}`,
            code: ErrorCodes_1.default.VIDEO_WAS_STOPPED_ALREADY,
            suggestion: ErrorSuggestions_1.default.VIDEO_WAS_STOPPED_ALREADY,
        }));
        delete this.onceDeferredIndex[srcArgumentsString];
    }
    /**
     * The `pause()` method pauses the video; playback can be resumed with `resume()`. Stopped video can't be paused.
     *
     * @param uri Address to remote (online) or local video file
     * @param x x-position for video on screen
     * @param y y-position for video on screen
     * @param width Video width on screen
     * @param height Video height on screen
     * @returns {Promise<void>} Returns a promise that resolves when the video is paused.
     * @throws Error If the parameters are not valid.
     * @throws Error If any error occurs during the pausing of the video.
     * @since 1.0.3
     *
     * @example
     * // Example of resuming a paused video
     * const { filePath } = await sos.offline.cache.loadOrSaveFile('video-1.mp4', 'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4');
     * const video = [filePath, 0, 0, 1920, 1080];
     * // Prepare the video
     * await sos.video.prepare(...video);
     * // Play the video
     * await sos.video.play(...video);
     * // Pause the video after 2 seconds
     * setTimeout(() => sos.video.pause(...video), 2000);
     */
    async pause(uri, x, y, width, height) {
        this.checkParamsValidity(uri, x, y, width, height);
        ({ x, y, width, height } = (0, coordinationsHelper_1.sanitizeCoordinations)({ x, y, width, height }));
        await this.postMessage({
            type: this.getMessage('pause'),
            uri,
            x,
            y,
            width,
            height,
        });
        this.createAndEmitEvent('pause', uri, x, y, width, height);
    }
    /**
     * The `resume()` method resumes the video paused by `pause()` function. Stopped video can't be resumed.
     *
     * @param uri Address to remote (online) or local video file
     * @param x x-position for video on screen
     * @param y y-position for video on screen
     * @param width Video width on screen
     * @param height Video height on screen
     * @returns {Promise<void>} Returns a promise that resolves when the video is resumed.
     * @throws Error If the parameters are not valid.
     * @throws Error If any error occurs during the resuming of the video.
     * @since 1.0.3
     *
     * @example
     * // Example of resuming a paused video
     * const { filePath } = await sos.offline.cache.loadOrSaveFile('video-1.mp4', 'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4');
     * const video = [filePath, 0, 0, 1920, 1080];
     * // Prepare the video
     * await sos.video.prepare(...video);
     * // Play the video
     * await sos.video.play(...video);
     * // Pause the video after 2 seconds
     * setTimeout(() => sos.video.pause(...video), 2000);
     * // Resume the video after 3 seconds
     * setTimeout(() => sos.video.resume(...video), 5000);
     */
    async resume(uri, x, y, width, height) {
        this.checkParamsValidity(uri, x, y, width, height);
        ({ x, y, width, height } = (0, coordinationsHelper_1.sanitizeCoordinations)({ x, y, width, height }));
        await this.postMessage({
            type: this.getMessage('resume'),
            uri,
            x,
            y,
            width,
            height,
        });
        this.createAndEmitEvent('resume', uri, x, y, width, height);
    }
    /**
     * The `onceEnded()` method returns a promise that is resolved after the specified video ends.
     *
     * @param uri Address to remote (online) or local video file
     * @param x x-position for video on screen
     * @param y y-position for video on screen
     * @param width Video width on screen
     * @param height Video height on screen
     * @returns {Promise<void>} Returns a promise that resolves when the video ends.
     * @throws Error If the parameters are not valid.
     * @throws Error If the video was not played yet.
     * @since 1.0.29
     *
     * @example
     * // Example of using onceEnded to wait for a video to end
     * await sos.video.prepare('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * while (true) {
     *   await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
     *   // Wait for the video to stop to start playing it again
     *   await sos.video.onceEnded('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * }
     */
    onceEnded(uri, x, y, width, height) {
        this.checkParamsValidity(uri, x, y, width, height);
        ({ x, y, width, height } = (0, coordinationsHelper_1.sanitizeCoordinations)({ x, y, width, height }));
        const srcArgumentsString = (0, IVideoEvent_1.stringifySrcArguments)(uri, x, y, width, height);
        const onceDeferreds = this.onceDeferredIndex[srcArgumentsString];
        if (typeof onceDeferreds === 'undefined') {
            throw new AppletVideoError_1.default({
                kind: 'appletVideoError',
                message: `This video was not played yet. The arguments: ${srcArgumentsString}`,
                code: ErrorCodes_1.default.VIDEO_WAS_NOT_PLAYED_YET,
                suggestion: ErrorSuggestions_1.default.VIDEO_WAS_NOT_PLAYED,
            });
        }
        return onceDeferreds.ended.oncePromise;
    }
    /**
     * The `onceStop()` method returns a promise that is resolved after the specified video has been stopped.
     *
     * @param uri Address to remote (online) or local video file
     * @param x x-position for video on screen
     * @param y y-position for video on screen
     * @param width Video width on screen
     * @param height Video height on screen
     * @returns {Promise<void>} Returns a promise that resolves when the video is stopped.
     * @throws Error If the parameters are not valid.
     * @throws Error If the video was not played yet.
     * @since 1.0.29
     *
     * @example
     * // Example of using onceStop to wait for a video to stop
     * await sos.video.prepare('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * while (true) {
     *   await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
     *   // Wait few seconds for the video to play
     *   await new Promise((resolve) => setTimeout(resolve, 5000));
     *   // Stop the video and wait for it to stop
     *   await sos.video.stop('https://example.com/video.mp4', 0, 0, 1920, 1080);
     *   await sos.video.onceStop('https://example.com/video.mp4', 0, 0, 1920, 1080);
     *   // Now the video is stopped, and we can play it again
     * }
     */
    onceStop(uri, x, y, width, height) {
        this.checkParamsValidity(uri, x, y, width, height);
        ({ x, y, width, height } = (0, coordinationsHelper_1.sanitizeCoordinations)({ x, y, width, height }));
        const srcArgumentsString = (0, IVideoEvent_1.stringifySrcArguments)(uri, x, y, width, height);
        const onceDeferreds = this.onceDeferredIndex[srcArgumentsString];
        if (typeof onceDeferreds === 'undefined') {
            throw new AppletVideoError_1.default({
                kind: 'appletVideoError',
                message: `This video was not played yet. The arguments: ${srcArgumentsString}`,
                code: ErrorCodes_1.default.VIDEO_WAS_NOT_PLAYED_YET,
                suggestion: ErrorSuggestions_1.default.VIDEO_WAS_NOT_PLAYED,
            });
        }
        return onceDeferreds.stop.oncePromise;
    }
    /**
     * The `onPlay()` method sets up a listener, which is called whenever a video starts to play.
     *
     * @param listener The listener function to be called when a play event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 1.0.3
     *
     * @example
     * // Play a video and handle the play event
     * await sos.video.prepare('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * sos.video.onPlay((event) => {
     *     console.log('Video started playing:', event);
     * });
     * await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
     */
    onPlay(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.addListener('play', listener);
    }
    /**
     * The `onPrepare()` method sets up a listener, which is called whenever a video starts to be prepared.
     *
     * @param listener The listener function to be called when a prepare event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 1.0.3
     *
     * @example
     * // Play a video and handle the prepare event
     * await sos.video.prepare('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * sos.video.onPrepare((event) => {
     *     console.log('Video prepared:', event);
     * });
     */
    onPrepare(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.addListener('prepare', listener);
    }
    /**
     * The `onStop()` method sets up a listener, which is called whenever a video has been stopped with `stop()` method.
     *
     * @param listener The listener function to be called when a stop event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 1.0.3
     *
     * @example
     * // Play a video and handle the stop event
     * await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * sos.video.onStop((event) => {
     *     console.log('Video stopped:', event);
     * });
     * // Stop the video later...
     * await sos.video.stop('https://example.com/video.mp4', 0, 0, 1920, 1080);
     */
    onStop(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.addListener('stop', listener);
    }
    /**
     * The `onPause()` method sets up a listener, which is called whenever a video is paused with `pause()` method.
     *
     * @param listener The listener function to be called when a pause event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 1.0.3
     *
     * @example
     * // Play a video and handle the pause event
     * await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * sos.video.onPause((event) => {
     *     console.log('Video paused:', event); // Logs the pause event
     * });
     */
    onPause(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.addListener('pause', listener);
    }
    /**
     * The `onResume()` method sets up a listener, which is called whenever a video is resumed with the `resume()` method.
     *
     * @param listener The listener function to be called when a resume event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 1.0.3
     *
     * @example
     * // Play a video and handle the resume event
     * await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * sos.video.onResume((event) => {
     *     console.log('Video resumed:', event); // Logs the resume event
     * });
     * await sos.video.pause('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * await sos.video.resume('https://example.com/video.mp4', 0, 0, 1920, 1080);
     */
    onResume(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.addListener('resume', listener);
    }
    /**
     * The `onEnded()` method sets up a listener, which is called whenever a video finished playing successfully.
     *
     * @param listener The listener function to be called when an ended event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 1.0.3
     *
     * @example
     * // Play a video and handle the end of playback
     * await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * sos.video.onEnded((event) => {
     *     console.log('Video ended:', event);
     * });
     */
    onEnded(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.addListener('ended', listener);
    }
    /**
     * The `onError()` method sets up a listener, which is called whenever a video failed to finish playing.
     *
     * @param listener The listener function to be called when an error occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 1.0.3
     *
     * @example
     * // Play a video and handle errors
     * await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
     * sos.video.onError((event) => {
     *     console.error('Video error:', event);
     * });
     */
    onError(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.addListener('error', listener);
    }
    /** @internal */
    handleMessageData(data) {
        switch (data.type) {
            case this.getMessage('ended'):
            case this.getMessage('error'): {
                const type = data.type.substring(this.getMessage('').length);
                this.createAndEmitEvent(type, data.uri, data.x, data.y, data.width, data.height);
                break;
            }
            default:
        }
    }
    /**
     * The `removeEventListeners()` method removes all listeners set up for all videos.
     */
    removeEventListeners() {
        this.eventEmitter.removeAllListeners();
    }
    createOncePromise(listenType, uri, x, y, width, height) {
        const deferred = {};
        deferred.oncePromise = new Promise((resolve, reject) => {
            deferred.reject = reject;
            const srcArguments = { uri, x, y, width, height };
            const listenEventName = (0, IVideoEvent_1.getEventName)({ type: listenType, srcArguments });
            const errorEventName = (0, IVideoEvent_1.getEventName)({ type: 'error', srcArguments });
            const listener = (event) => {
                if (JSON.stringify(event.srcArguments) === JSON.stringify({ uri, x, y, width, height })) {
                    this.eventEmitter.removeListener(listenEventName, listener);
                    this.eventEmitter.removeListener(errorEventName, listener);
                    if (event.type === listenType) {
                        resolve();
                    }
                    else if (event.type === 'error') {
                        reject(new SosError_1.default({
                            kind: 'sosError',
                            message: JSON.stringify(event.srcArguments),
                            code: ErrorCodes_1.default.UNEXPECTED_EXCEPTION,
                        }));
                    }
                }
            };
            this.eventEmitter.addListener(listenEventName, listener);
            this.eventEmitter.addListener(errorEventName, listener);
        });
        return deferred;
    }
    getMessage(name) {
        return this.messagePrefix + '.' + Video.MESSAGE_PREFIX + '.' + name;
    }
    removeAllVideoListeners(uri, x, y, width, height) {
        for (const type of IVideoEvent_1.VIDEO_EVENT_TYPES) {
            const eventName = (0, IVideoEvent_1.getEventName)({ type, srcArguments: { uri, x, y, width, height } });
            this.eventEmitter.removeAllListeners(eventName);
        }
    }
    createAndEmitEvent(type, uri, x, y, width, height) {
        const videoEvent = {
            type,
            srcArguments: {
                uri,
                x,
                y,
                width,
                height,
            },
        };
        const eventName = (0, IVideoEvent_1.getEventName)(videoEvent);
        this.eventEmitter.emit(eventName, videoEvent);
        this.eventEmitter.emit(videoEvent.type, videoEvent);
    }
    checkParamsValidity(uri, x, y, width, height) {
        (0, Validate_1.default)({ uri }).required().uri();
        (0, Validate_1.default)({ x }).required().number();
        (0, Validate_1.default)({ y }).required().number();
        (0, Validate_1.default)({ width }).required().number();
        (0, Validate_1.default)({ height }).required().number();
    }
}
exports.default = Video;
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Number, Number, Number, Number]),
    __metadata("design:returntype", Promise)
], Video.prototype, "play", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Number, Number, Number, Number, Object]),
    __metadata("design:returntype", Promise)
], Video.prototype, "prepare", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Number, Number, Number, Number]),
    __metadata("design:returntype", Promise)
], Video.prototype, "stop", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Number, Number, Number, Number]),
    __metadata("design:returntype", Promise)
], Video.prototype, "pause", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Number, Number, Number, Number]),
    __metadata("design:returntype", Promise)
], Video.prototype, "resume", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Number, Number, Number, Number]),
    __metadata("design:returntype", Promise)
], Video.prototype, "onceEnded", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Number, Number, Number, Number]),
    __metadata("design:returntype", Promise)
], Video.prototype, "onceStop", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Video.prototype, "onPlay", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Video.prototype, "onPrepare", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Video.prototype, "onStop", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Video.prototype, "onPause", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Video.prototype, "onResume", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Video.prototype, "onEnded", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Video.prototype, "onError", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], Video.prototype, "removeEventListeners", null);
//# sourceMappingURL=Video.js.map