@rtn263net/cloudhub-rts-electron-sdk
Version:
cloudhub-rts-electron-sdk
69 lines (68 loc) • 2.57 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const log_1 = __importDefault(require("../helpers/log"));
const Renderer_1 = require("../Renderer");
const initRtsMixingUpstream_1 = __importDefault(require("./initRtsMixingUpstream"));
class RtsMixingUpstream extends initRtsMixingUpstream_1.default {
constructor(clientId) {
super(clientId);
}
startPush(url) {
log_1.default.info(`startPush urlPush:${url}`);
if (!url)
return;
this.cMixingUpstreamPusher.startPush(url);
}
invokeMethod(name, url) {
log_1.default.info(`invokeMethod name:${name} url:${url}`);
this.cMixingUpstreamPusher.invokeMethod(name, JSON.stringify({ "uri": url }));
}
stopPush() {
log_1.default.info('stopPush');
this.cMixingUpstreamPusher.stopPush();
}
isPushing() {
log_1.default.info('isPushing');
return this.cMixingUpstreamPusher.isPushing();
}
getClientId() {
log_1.default.info('getClientId');
return this.cMixingUpstreamPusher.getClientId();
}
getUrl() {
log_1.default.info('getUrl ');
return this.cMixingUpstreamPusher.getUrl();
}
configMixing(obj) {
log_1.default.info(`configMixing obj:${obj}`);
return this.cMixingUpstreamPusher.configMixing(obj);
}
setupLocalVideo(view) {
log_1.default.info(`setupLocalVideo view: ${view}`);
this.cMixingUpstreamPusher.setupLocalVideo();
const sourceId = this.cMixingUpstreamPusher.getClientId();
const renderer = new Renderer_1.GlRenderer();
renderer.bind(view);
this.streamRenders[sourceId] = renderer;
}
removeLocalVideo() {
log_1.default.info('removeLocalVideo');
const sourceId = this.cMixingUpstreamPusher.getClientId();
const rendererLocal = this.streamRenders[sourceId];
if (rendererLocal) {
rendererLocal.unbind();
delete this.streamRenders[sourceId];
}
this.cMixingUpstreamPusher.removeLocalVideo();
}
onEvent(eventNname, fn) {
const newS = eventNname.slice(2);
const first = newS[0].toLowerCase();
const new_eventNname = first + newS.slice(1);
this.innerEvent.on(new_eventNname, fn);
}
}
exports.default = RtsMixingUpstream;