"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 AppletStreamError_1 = __importDefault(require("../Error/AppletStreamError"));
const ErrorCodes_1 = __importDefault(require("../Error/ErrorCodes"));
const Validate_1 = __importDefault(require("../Validate/Validate"));
const DEBUG_NAMESPACE = '@signageos/front-applet:FrontApplet:Stream';
/**
 * The `sos.stream` API groups together methods for streaming videos from different sources. There are various methods for preparing, playing, stopping, pausing, and resuming streams.
 *
 * Streams are identified by their URI and their position on the screen (x, y, width, height).
 *
 * This API allows you to play video stream from:
 * - URL (e.g., HTTP, RTSP, RTP, UDP, RTMP)
 * - HDMI (e.g., Picture-in-Picture, Internal ports) streams
 *
 * :::warning
 * Are you using **Samsung Tizen** to play streams? Read more about limitation and
 * [Tizen-specific details](https://docs.signageos.io/hc/en-us/articles/4405387373458).
 * :::
 *
 * :::danger
 * Be aware version of JS API (v6.0.0+) changed how stream functions `play()` and `prepare()` work. For using an options object you need to
 * our latest core app versions. If you are using older core app versions, you need to use deprecated format.
 * :::
 */
class Stream {
    messagePrefix;
    postMessage;
    static MESSAGE_PREFIX = 'stream';
    eventEmitter;
    /** @internal */
    constructor(messagePrefix, postMessage) {
        this.messagePrefix = messagePrefix;
        this.postMessage = postMessage;
        this.eventEmitter = new events_1.EventEmitter();
    }
    /**
     * Calls the internal player and prepares a video stream in memory, so it can later start playing instantaneously.
     *
     * :::info
     * If you want to play a video stream in full screen mode, use x = y = 0 and width = document.documentElement.clientWidth and height = document.documentElement.clientHeight as setup parameters.
     * :::
     *
     * @param uri Network address where the stream is available.
     * @param x Stream x-position on the screen
     * @param y Stream y-position on the screen
     * @param width Stream width on the screen
     * @param height Stream height on the screen
     * @param options Additional options for the stream
     *
     * @returns {Promise<void>} Returns a promise that resolves when the stream is prepared.
     * @throws AppletStreamError If the protocol is not a string or if the parameters are invalid.
     * @throws Error If parameters are invalid.
     * @throws Error If device fail to prepare the stream.
     * @since 4.7.0
     *
     * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/stream | How to create video Applet with for streams}
     * @example
     * // Example with specific protocol type
     * await sos.stream.prepare(uri, x, y, width, height, { protocol: 'HTTP' });
     *
     * // Example with options - prepare stream in the background
     * await sos.stream.prepare(uri, x, y, width, height, { protocol: 'HTTP', background: true });
     *
     * // Deprecated format
     * await sos.stream.prepare(uri, x, y, width, height, 'HTTP');
     */
    async prepare(uri, x, y, width, height, options) {
        let streamOptions;
        if (typeof options === 'string') {
            streamOptions = { protocol: options };
        }
        else {
            streamOptions = options;
        }
        let protocol = undefined;
        if (streamOptions?.protocol) {
            protocol = streamOptions.protocol;
        }
        if (protocol && typeof protocol !== 'string') {
            throw new AppletStreamError_1.default({
                kind: 'appletStreamError',
                message: 'Invalid format of protocol, must be string.',
                code: ErrorCodes_1.default.STREAM_INVALID_PROTOCOL_TYPE,
            });
        }
        this.checkParamsValidity(uri, x, y, width, height);
        this.createAndEmitEvent('prepare', {
            type: 'prepare',
            srcArguments: {
                uri,
                x,
                y,
                width,
                height,
                protocol,
            },
        });
        return this.postMessage({
            type: this.getMessage('prepare'),
            uri,
            x,
            y,
            width,
            height,
            protocol,
            options: streamOptions,
        });
    }
    /**
     * The `play()` method starts the video stream based by uri or stream which was prepared by `prepare()` method.
     *
     * :::note Internal ports
     * This method use same functionality, instead of URL (for stream), specify a URI of the port to display.
     *
     * | Port URI value | Description |
     * |-----------------|-------------|
     * | `internal://hdmi<number>` | HDMI |
     * | `internal://dp` | DisplayPort |
     * | `internal://dvi` | DVI |
     * | `internal://pc` | PC or VGA |
     *
     * `<number>` has to be a value between 1 - 4, depending on which of the available HDMI ports you want to use.
     * :::
     *
     * @param uri Network address where the stream is available.
     * @param x Stream x-position on the screen
     * @param y Stream y-position on the screen
     * @param width Stream width on the screen
     * @param height Stream height on the screen
     * @param options Additional options for the stream
     *
     * @returns {Promise<void>} Returns a promise that resolves when the stream is successfully started.
     * @throws AppletStreamError If the protocol is not a string or if the parameters are invalid.
     * @throws Error If parameters are invalid.
     * @throws Error If the device fails to prepare the stream.
     * @since 1.0.18
     *
     * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/stream | How to create video Applet with for URL streams}
     * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/stream-hdmi-port | How to create video Applet with HDMI port}
     * @example
     * // Example with specific protocol type
     * await sos.stream.play(uri, x, y, width, height, { protocol: 'HTTP' });
     *
     * // Example with options - reconnect stream when it disconnects after 60 seconds
     * await sos.stream.play(uri, x, y, width, height, { protocol: 'HTTP', autoReconnect: true, autoReconnectInterval: 60000 });
     *
     * // Example for playing HDMI port
     * await sos.stream.play('internal://hdmi1', 0, 0, 1920, 1080, { protocol: 'RTP' });
     */
    async play(uri, x, y, width, height, options) {
        let streamOptions;
        if (typeof options === 'string') {
            // Legacy format
            streamOptions = { protocol: options };
        }
        else {
            // New format
            streamOptions = options;
        }
        let protocol = undefined;
        if (streamOptions?.protocol) {
            protocol = streamOptions.protocol;
        }
        this.checkParamsValidity(uri, x, y, width, height);
        ({ x, y, width, height } = (0, coordinationsHelper_1.sanitizeCoordinations)({ x, y, width, height }));
        if (protocol && typeof protocol !== 'string') {
            throw new AppletStreamError_1.default({
                kind: 'appletStreamError',
                message: 'Invalid format of protocol, must be string.',
                code: ErrorCodes_1.default.STREAM_INVALID_PROTOCOL_TYPE,
            });
        }
        this.createAndEmitEvent('play', {
            type: 'play',
            srcArguments: {
                uri,
                x,
                y,
                width,
                height,
                protocol,
            },
        });
        return this.postMessage({
            type: this.getMessage('play'),
            uri,
            x,
            y,
            width,
            height,
            protocol,
            options: streamOptions,
        });
    }
    /**
     * The `stop()` method stops the active stream, it can't be later resumed with `resume()`.
     *
     * @param uri Network address where the stream is available.
     * @param x Stream x-position on the screen
     * @param y Stream y-position on the screen
     * @param width Stream width on the screen
     * @param height Stream height on the screen
     * @returns {Promise<void>} Returns a promise that resolves when the stream is stopped.
     * @throws Error If parameters are invalid.
     * @since 1.0.18
     *
     * @example
     * // Example of stopping an active stream
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080); // Start
     * // ... after some time
     * await sos.stream.stop('http://example.com/stream', 0, 0, 1920, 1080); // Stop
     */
    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 }));
        this.createAndEmitEvent('stop', {
            type: 'stop',
            srcArguments: {
                uri,
                x,
                y,
                width,
                height,
            },
        });
        return this.postMessage({
            type: this.getMessage('stop'),
            uri,
            x,
            y,
            width,
            height,
        });
    }
    /**
     * The `pause()` method pauses the active stream, it can be resumed with `resume()`.
     *
     * @param uri Network address where the stream is available.
     * @param x Stream x-position on the screen
     * @param y Stream y-position on the screen
     * @param width Stream width on the screen
     * @param height Stream height on the screen
     * @returns {Promise<void>} Returns a promise that resolves when the stream is paused.
     * @throws Error If parameters are invalid.
     * @since 6.4.0
     *
     * @example
     * // Example of pausing an active stream
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080); // Start
     * // ... after some time
     * await sos.stream.pause('http://example.com/stream', 0, 0, 1920, 1080); // Pause
     */
    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 }));
        this.createAndEmitEvent('pause', {
            type: 'pause',
            srcArguments: {
                uri,
                x,
                y,
                width,
                height,
            },
        });
        return this.postMessage({
            type: this.getMessage('pause'),
            uri,
            x,
            y,
            width,
            height,
        });
    }
    /**
     * The `resume()` method resumes the paused stream by `pause()` function.
     *
     * @param uri Network address where the stream is available.
     * @param x Stream x-position on the screen
     * @param y Stream y-position on the screen
     * @param width Stream width on the screen
     * @param height Stream height on the screen
     * @returns {Promise<void>} Returns a promise that resolves when the stream is successfully resumed.
     * @throws Error If parameters are invalid.
     * @since 6.4.0
     *
     * @example
     * // Example of resuming a paused stream
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080); // Start
     * await sos.stream.pause('http://example.com/stream', 0, 0, 1920, 1080); // Pause
     * // ... after some time
     * await sos.stream.resume('http://example.com/stream', 0, 0, 1920, 1080); // Resume
     */
    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 }));
        this.createAndEmitEvent('resume', {
            type: 'resume',
            srcArguments: {
                uri,
                x,
                y,
                width,
                height,
            },
        });
        return this.postMessage({
            type: this.getMessage('resume'),
            uri,
            x,
            y,
            width,
            height,
        });
    }
    /**
     * The `getTracks()` method returns a list of subtitles, video, and audio tracks of a stream.
     *
     * @param videoId The video properties of the stream to get tracks for.
     * @returns {Promise<ITrackInfo[]>} Returns array of object with information about subtitles, video, and audio tracks.
     * @since 6.1.0
     *
     * @example
     * // Example of getting tracks for a stream
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
     * const tracks = await sos.stream.getTracks(streamId);
     * console.log(tracks); // Outputs an array of track information
     */
    async getTracks(videoId) {
        (0, Validate_1.default)({ videoId }).required().object();
        const { tracks } = await this.postMessage({ type: this.getMessage('get_tracks'), videoId });
        return tracks;
    }
    /**
     * The `selectTrack()` method selects a text (subtitles), video or audio track of a stream.
     *
     * @param videoId The video properties of the stream to select track for.
     * @param trackType The type of the track to select (e.g., 'TEXT', 'AUDIO', 'VIDEO').
     * @param groupId The group ID of the track to select.
     * @param trackIndex The index of the track to select within the group.
     * @throws Error If parameters are invalid or if the track type is not supported.
     * @returns {Promise<void>} Resolves when the track is successfully selected.
     * @since 6.1.0
     *
     * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/stream-subtitles | How to set subtitles for a stream}
     *
     * @example
     * // Example of selecting a track for a stream
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
     *
     * // Select the first audio track in the group with ID 'audioGroup1'
     * await sos.stream.selectTrack(videoId, 'AUDIO', 'audioGroup1', 0);
     * // Select the first text track in the group with ID 'subtitlesGroup1'
     * await sos.stream.selectTrack(videoId, 'TEXT', 'subtitlesGroup1', 0);
     * // Select the first video track in the group with ID 'videoGroup1'
     * await sos.stream.selectTrack(videoId, 'VIDEO', 'videoGroup1', 0);
     */
    async selectTrack(videoId, trackType, groupId, trackIndex) {
        (0, Validate_1.default)({ videoId }).required().object();
        (0, Validate_1.default)({ trackType }).required().string();
        (0, Validate_1.default)({ groupId }).required().string();
        (0, Validate_1.default)({ trackIndex }).required().number();
        return this.postMessage({ type: this.getMessage('select_track'), videoId, trackType, groupId, trackIndex });
    }
    /**
     * The `resetTrack()` method resets a selected track of a stream.
     *
     * @param videoId The video properties of the stream to reset track for.
     * @param trackType The type of the track to reset (e.g., 'TEXT', 'AUDIO', 'VIDEO').
     * @param groupId The group ID of the track to reset. If not provided, the first track in the group will be reset.
     * @throws Error If parameters are invalid or if the track type is not supported.
     * @returns {Promise<void>} Resolves when the track is successfully reset.
     *
     * @since 6.1.0
     *
     * @example
     * // Example of resetting a track for a stream
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
     * // Reset the audio track in the group with ID 'audioGroup1'
     * await sos.stream.resetTrack(videoId, 'AUDIO', 'audioGroup1');
     */
    async resetTrack(videoId, trackType, groupId) {
        (0, Validate_1.default)({ videoId }).required().object();
        (0, Validate_1.default)({ trackType }).required().string();
        if (groupId) {
            (0, Validate_1.default)({ groupId }).string();
        }
        return this.postMessage({ type: this.getMessage('reset_track'), videoId, trackType, groupId });
    }
    /**
     * The `onTracksChanged()` method sets up a listener, which is called whenever a track is changed
     * from functions `selectTrack()` or `resetTrack()`.
     *
     * @param listener The listener function to be called when the event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 6.1.0
     *
     * @example
     * // Example of setting up a listener with starting a stream and selecting a track
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
     * await sos.stream.selectTrack(videoId, 'AUDIO', 'audioGroup1', 0);
     *
     * // Create the listener for tracks changed event
     * sos.stream.onTracksChanged((event) => {
     *     console.log('Track type:', event.tracks[0].trackType); // AUDIO
     *     console.log('Track group ID:', event.tracks[0].groupId); // audioGroup1
     *     console.log('Track index:', event.tracks[0].trackIndex); // 0
     * });
     */
    onTracksChanged(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.on('tracks_changed', listener);
    }
    /**
     * The `onError()` method sets up a listener, which is called whenever an unexpected error occurs during a stream.
     *
     * @param listener The listener function to be called when the event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 1.0.20
     *
     * @example
     * // Example of setting up a listener for the error event
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
     * sos.stream.onError((event) => {
     *     console.error('Stream error:', event.errorMessage);
     * });
     */
    onError(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.on('error', listener);
    }
    /**
     * The `onConnected()` method sets up a listener, which is called whenever a stream is connected.
     *
     * @param listener The listener function to be called when the event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 1.0.20
     *
     * @example
     * // Example of setting up a listener for the connected event
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
     * sos.stream.onConnected((event) => {
     *   console.log('Stream connected:', event.srcArguments.uri);
     * });
     */
    onConnected(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.on('connected', listener);
    }
    /**
     * The `onDisconnected()` method sets up a listener, which is called whenever a stream gets disconnected.
     * Usually when source URI is not available anymore or when the stream is stopped.
     *
     * @param listener The listener function to be called when the event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 1.0.20
     *
     * @example
     * // Example of setting up a listener for the disconnected event
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
     * sos.stream.onDisconnected((event) => {
     *     console.log('Stream disconnected:', event.srcArguments.uri);
     * });
     */
    onDisconnected(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.on('disconnected', listener);
    }
    /**
     * The `onPrepare()` method sets up a listener, which is called whenever a stream gets prepared.
     *
     * @param listener The listener function to be called when the event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 5.12.0
     *
     * @example
     * // Example of setting up a listener for the prepare event
     * await sos.stream.prepare('http://example.com/stream', 0, 0, 1920, 1080);
     * sos.stream.onPrepare((event) => {
     *     console.log('Stream prepared:', event.srcArguments.uri);
     * });
     */
    onPrepare(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.on('prepare', listener);
    }
    /**
     * The `onPlay()` method sets up a listener, which is called whenever a stream starts playing.
     *
     * @param listener The listener function to be called when the event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 5.12.0
     *
     * @example
     * // Example of setting up a listener for the play event
     * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
     * sos.stream.onPlay((event) => {
     *     console.log('Stream started playing:', event.srcArguments.uri);
     * });
     */
    onPlay(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.on('play', listener);
    }
    /**
     * The `onStop()` method sets up a listener, which is called whenever a stream stops.
     *
     * @param listener The listener function to be called when the event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 5.12.0
     *
     * @example
     * // Example of setting up a listener for the stop event
     * await sos.stream.stop('http://example.com/stream', 0, 0, 1920, 1080);
     * sos.stream.onStop((event) => {
     *     console.log('Stream stopped:', event.srcArguments.uri);
     * });
     */
    onStop(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.on('stop', listener);
    }
    /**
     * The `onPause()` method sets up a listener, which is called whenever a stream is paused.
     *
     * @param listener The listener function to be called when the event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 5.12.0
     *
     * @example
     * // Example of setting up a listener for the pause event
     * await sos.stream.pause('http://example.com/stream', 0, 0, 1920, 1080);
     * sos.stream.onPause((event) => {
     *     console.log('Stream paused:', event.srcArguments.uri);
     * });
     */
    onPause(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.on('pause', listener);
    }
    /**
     * The `onResume()` method sets up a listener, which is called whenever a stream is resumed.
     *
     * @param listener The listener function to be called when the event occurs.
     * @returns {void} Resolves when the listener is successfully set up.
     * @since 5.12.0
     *
     * @example
     * // Example of setting up a listener for the resume event
     * await sos.stream.pause('http://example.com/stream', 0, 0, 1920, 1080); // Pause the stream
     * // ... after some time
     * await sos.stream.resume('http://example.com/stream', 0, 0, 1920, 1080);
     * sos.stream.onResume((event) => {
     *     console.log('Stream resumed:', event.srcArguments.uri);
     * });
     */
    onResume(listener) {
        (0, Validate_1.default)({ listener }).required().function();
        this.eventEmitter.on('resume', listener);
    }
    /** @internal */
    handleMessageData(data) {
        switch (data.type) {
            case this.getMessage('error'):
                this.createAndEmitEvent('error', {
                    type: 'error',
                    srcArguments: {
                        uri: data.uri,
                        x: data.x,
                        y: data.y,
                        width: data.width,
                        height: data.height,
                        protocol: data.options?.protocol ?? data.protocol,
                    },
                    errorMessage: data.errorMessage,
                });
                break;
            case this.getMessage('connected'):
                this.createAndEmitEvent('connected', {
                    type: 'connected',
                    srcArguments: {
                        uri: data.uri,
                        x: data.x,
                        y: data.y,
                        width: data.width,
                        height: data.height,
                        protocol: data.options?.protocol ?? data.protocol,
                    },
                });
                break;
            case this.getMessage('disconnected'):
                this.createAndEmitEvent('disconnected', {
                    type: 'disconnected',
                    srcArguments: {
                        uri: data.uri,
                        x: data.x,
                        y: data.y,
                        width: data.width,
                        height: data.height,
                        protocol: data.options?.protocol ?? data.protocol,
                    },
                });
                break;
            case this.getMessage('tracks_changed'):
                this.createAndEmitEvent('tracks_changed', {
                    type: 'tracks_changed',
                    srcArguments: {
                        uri: data.uri,
                        x: data.x,
                        y: data.y,
                        width: data.width,
                        height: data.height,
                    },
                    tracks: data.tracks,
                });
                break;
            default:
        }
    }
    /**
     * The `removeEventListeners()` removes all listeners set up on `sos.stream`.
     */
    removeEventListeners() {
        this.eventEmitter.removeAllListeners();
    }
    createAndEmitEvent(type, event) {
        this.eventEmitter.emit(type, event);
    }
    getMessage(name) {
        return this.messagePrefix + '.' + Stream.MESSAGE_PREFIX + '.' + name;
    }
    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 = Stream;
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Number, Number, Number, Number, Object]),
    __metadata("design:returntype", Promise)
], Stream.prototype, "prepare", 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)
], Stream.prototype, "play", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Number, Number, Number, Number]),
    __metadata("design:returntype", Promise)
], Stream.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)
], Stream.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)
], Stream.prototype, "resume", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], Stream.prototype, "getTracks", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, String, Number]),
    __metadata("design:returntype", Promise)
], Stream.prototype, "selectTrack", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, String]),
    __metadata("design:returntype", Promise)
], Stream.prototype, "resetTrack", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Stream.prototype, "onTracksChanged", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Stream.prototype, "onError", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Stream.prototype, "onConnected", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Stream.prototype, "onDisconnected", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Stream.prototype, "onPrepare", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Stream.prototype, "onPlay", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Stream.prototype, "onStop", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Stream.prototype, "onPause", null);
__decorate([
    (0, debugDecorator_1.debug)(DEBUG_NAMESPACE),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Stream.prototype, "onResume", null);
//# sourceMappingURL=Stream.js.map