"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleVideoRequests = handleVideoRequests;
const videoCommands_1 = require("./videoCommands");
function handleVideoRequests(_onCommand, dispatch, frontApplet) {
    frontApplet.video.onPlay((event) => {
        dispatch({
            type: videoCommands_1.VideoStateChanged,
            state: 'play',
            ...event.srcArguments,
        });
    });
    frontApplet.video.onPrepare((event) => {
        dispatch({
            type: videoCommands_1.VideoStateChanged,
            state: 'prepare',
            ...event.srcArguments,
        });
    });
    frontApplet.video.onStop((event) => {
        dispatch({
            type: videoCommands_1.VideoStateChanged,
            state: 'stop',
            ...event.srcArguments,
        });
    });
    frontApplet.video.onPause((event) => {
        dispatch({
            type: videoCommands_1.VideoStateChanged,
            state: 'pause',
            ...event.srcArguments,
        });
    });
    frontApplet.video.onResume((event) => {
        dispatch({
            type: videoCommands_1.VideoStateChanged,
            state: 'resume',
            ...event.srcArguments,
        });
    });
    frontApplet.video.onEnded((event) => {
        dispatch({
            type: videoCommands_1.VideoStateChanged,
            state: 'ended',
            ...event.srcArguments,
        });
    });
    frontApplet.video.onError((event) => {
        dispatch({
            type: videoCommands_1.VideoStateChanged,
            state: 'error',
            ...event.srcArguments,
        });
    });
}
//# sourceMappingURL=handleVideoRequests.js.map