roadofcloud-playback-sdk
Version:
CloudHubPlaybackSdk
36 lines (35 loc) • 1.49 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Action_1 = __importDefault(require("./Action"));
const global_1 = __importDefault(require("../global"));
const Logger_1 = __importDefault(require("../Logger"));
const utils_1 = __importDefault(require("../helper/utils"));
class RemoteVideoStateChangedAction extends Action_1.default {
constructor(jsonString, room) {
super(jsonString, room);
this.eventType = global_1.default.eventType.remoteVideoStateChanged;
this.user = room.getUser(this.userName);
Logger_1.default.info(`RemoteVideoStateChangedAction`, 'this:', this);
}
toEventObject() {
return {
uid: this.userName || '',
state: this.method === 'cancelPublisher' ? 0 : 1,
mediaType: this.getMediaType(),
reason: '',
sourceId: ''
};
}
getMediaType() {
if (this.method === 'cancelPublisher') {
//取消视频 数据中没有mediaType 需要自己拼凑
const mediaType = this.user.getStreamType(this.streamId);
return utils_1.default.getMediaStatus(mediaType);
}
return utils_1.default.getMediaStatus(this.options.attributes.type);
}
}
exports.default = RemoteVideoStateChangedAction;