decord/source/modules/go_live/GoLiveQualityManager.tsx

131 lines
4 KiB
TypeScript
Raw Normal View History

// Module ID: 13914
// Function ID: 13915
// Name: GoLiveQualityManager
// Dependencies: [4696, 3, 1953, 2]
2026-07-20 16:05:17 +00:00
// Module 13914 (GoLiveQualityManager)
import LoggerDefault from "Logger" /* 3 */;
import Timers from "Timers" /* 1953 */;
import TypedEventEmitter from "TypedEventEmitter" /* 4696 */;
2026-07-23 10:11:24 +00:00
require = fn;
const GoLiveQualityManagerEvent = { RequestedSSRCsUpdate: "requested-ssrcs-update", RequestedStreamsUpdate: "requested-streams-update" };
2026-07-29 08:29:29 +00:00
class GoLiveQualityManager extends tmp2 {
constructor() {
2026-08-24 06:08:38 +00:00
closure_0 = undefined;
2026-07-29 08:29:29 +00:00
tmp6 = new GoLiveQualityManager(tmp5, tmp4, tmp3, new.target, new.target, tmp2, undefined, tmp);
2026-08-24 06:08:38 +00:00
closure_0 = tmp6;
2026-07-29 08:29:29 +00:00
tmp6.streamId = null;
tmp6.resolutionWidth = 0;
tmp6.resolutionHeight = 0;
tmp6.zoom = 1;
tmp6.audioSSRC = 0;
tmp6.incomingVideoEnabled = true;
tmp6.delayedUpdate = function delayedUpdate() {
const delayedCall = closure_0.delayedCall;
2026-07-29 08:29:29 +00:00
delayedCall.delay();
};
tmp7 = new closure_1(closure_2[1])("GoLiveQualityManager");
2026-07-29 08:29:29 +00:00
tmp6.logger = tmp7;
logger = tmp6.logger;
enableNativeLoggerResult = logger.enableNativeLogger(true);
delayedCall = new closure_0(closure_2[2]).DelayedCall(500, () => {
closure_0.update();
2026-07-29 08:29:29 +00:00
});
tmp6.delayedCall = delayedCall;
return tmp6;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const prototype = GoLiveQualityManager.prototype;
prototype["setUserID"] = function setUserID(userId) {
this.userId = userId;
};
prototype["getUserID"] = function getUserID() {
return this.userId;
};
prototype["updateAudioAndVideoStreamInfo"] = function updateAudioAndVideoStreamInfo(audioSSRC, items) {
this.audioSSRC = audioSSRC;
this.videoStream = items.find((active) => active.active);
this.update();
};
prototype["onIncomingVideoEnabled"] = function onIncomingVideoEnabled(incomingVideoEnabled) {
const self = this;
if (this.incomingVideoEnabled !== incomingVideoEnabled) {
const logger = self.logger;
logger.info("onIncomingVideoEnabled", incomingVideoEnabled);
self.incomingVideoEnabled = incomingVideoEnabled;
self.update();
}
};
prototype["update"] = function update() {
const self = this;
if (tmp) {
if (self.incomingVideoEnabled) {
const stream = self.requestStream();
} else {
self.stopStream();
}
}
};
prototype["requestStream"] = function requestStream() {
const self = this;
if (null != this.videoStream) {
const obj = {};
2026-07-29 08:29:29 +00:00
obj[self.videoStream.ssrc] = 100;
const items = [self.videoStream.ssrc];
self.request(obj, items);
}
};
prototype["stopStream"] = function stopStream() {
const self = this;
if (null != this.videoStream) {
const obj = {};
2026-07-29 08:29:29 +00:00
obj[self.videoStream.ssrc] = 0;
self.request(obj, []);
}
};
prototype["request"] = function request(arg0, arr) {
const self = this;
2026-07-29 08:29:29 +00:00
if (undefined !== this.userId) {
const pixelCounts = arg0;
const item = arr.forEach((item) => {
2026-07-29 08:29:29 +00:00
if (null == pixelCounts.pixelCounts) {
tmp.pixelCounts = {};
}
if (pixelCounts[item] > 0) {
2026-07-29 08:29:29 +00:00
const _Math = Math;
tmp.pixelCounts[item] = Math.floor(self.resolutionWidth * self.resolutionHeight * self.zoom * self.zoom);
2026-07-29 08:29:29 +00:00
}
});
self.emit(obj.RequestedSSRCsUpdate, self.userId, self.audioSSRC, arr);
self.emit(obj.RequestedStreamsUpdate, arg0);
}
};
prototype["setVideoSize"] = function setVideoSize(arg0, arg1, zoom) {
const self = this;
if (this.streamId === arg0) {
if (null != arg1) {
({ width: self.resolutionWidth, height: self.resolutionHeight } = arg1);
}
if (null != zoom) {
self.zoom = zoom;
}
self.delayedUpdate();
}
};
prototype["setStreamId"] = function setStreamId(streamId) {
const self = this;
if (this.streamId !== streamId) {
self.streamId = streamId;
self.resolutionWidth = 0;
self.resolutionHeight = 0;
self.zoom = 1;
self.delayedUpdate();
}
};
const size = fn(2);
const result = size.fileFinishedImporting("modules/go_live/GoLiveQualityManager.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default GoLiveQualityManager;
export { GoLiveQualityManagerEvent };