UNPKG

roadofcloud-playback-sdk

Version:

CloudHubPlaybackSdk

37 lines (36 loc) 1.89 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const PubMsgAction_1 = __importDefault(require("./PubMsgAction")); const SetPropertyAction_1 = __importDefault(require("./SetPropertyAction")); const DelMsgAction_1 = __importDefault(require("./DelMsgAction")); const SendChatMsgAction_1 = __importDefault(require("./SendChatMsgAction")); const UserJoinAction_1 = __importDefault(require("./UserJoinAction")); const UserLeaveAction_1 = __importDefault(require("./UserLeaveAction")); const RemoteVideoStateChangedAction_1 = __importDefault(require("./RemoteVideoStateChangedAction")); const RoomController_1 = __importDefault(require("../controllers/RoomController")); class ActionFactory { static create(jsonString, room = RoomController_1.default) { switch (jsonString['method']) { case 'join': return new UserJoinAction_1.default(jsonString, room); case 'LEAVE': return new UserLeaveAction_1.default(jsonString, room); case 'PubMsg': return new PubMsgAction_1.default(jsonString, room); case 'DelMsg': return new DelMsgAction_1.default(jsonString, room); case 'SendChatMessage': return new SendChatMsgAction_1.default(jsonString, room); case 'setProperty': return new SetPropertyAction_1.default(jsonString, room); // case 'newPublisher': // return new RemoteVideoStateChangedAction(jsonString, room) case 'cancelPublisher': return new RemoteVideoStateChangedAction_1.default(jsonString, room); } } } exports.default = ActionFactory;