decord/beta/source/modules/calls/VideoSpeakerStore.tsx
github-actions e7a050048e chore: update source for beta 347.7
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4943.js (118.4 MB)
2026-09-21 19:31:18 +00:00

170 lines
5.2 KiB
TypeScript

// Module ID: 9656
// Function ID: 9657
// Name: VideoSpeakerStore
// Dependencies: [4780, 502, 1996, 5638, 4774, 4779, 4810, 12, 504, 577, 2]
// Module 9656 (VideoSpeakerStore)
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 577 */;
import StreamKeyUtils from "StreamKeyUtils" /* 4810 */;
import ApplicationStreamingStore from "ApplicationStreamingStore" /* 4780 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import MediaEngineStore from "MediaEngineStore" /* 1996 */;
import SpeakingStore from "SpeakingStore" /* 5638 */;
import ChannelRTCStore from "ChannelRTCStore" /* 4774 */;
import apply from "module_12" /* 12 */;
require = fn;
function updateSpeaker(arg0) {
let userId;
let flag = arg0;
if (arg0 === undefined) {
flag = true;
}
let tmp2 = null;
if (null != global) {
let selectedParticipantId = ChannelRTCStore.getSelectedParticipantId(global);
let result = null != selectedParticipantId;
if (result) {
result = obj.isParticipantPoppedOut(global, selectedParticipantId);
}
if (result) {
selectedParticipantId = null;
}
const lastActiveStream = ApplicationStreamingStore.getLastActiveStream();
let participant = null;
if (null != selectedParticipantId) {
participant = obj.getParticipant(global, selectedParticipantId);
}
let type;
if (participant != null) {
type = participant.type;
}
let tmp16 = type === ParticipantTypes.ACTIVITY;
if (!tmp16) {
let type1;
if (participant != null) {
type1 = participant.type;
}
let tmp18 = type1 === tmp15.USER;
if (tmp18) {
const voiceState = participant.voiceState;
let selfVideo;
if (voiceState != null) {
selfVideo = voiceState.selfVideo;
}
tmp18 = !selfVideo;
}
tmp16 = tmp18;
}
let tmp20 = selectedParticipantId;
if (tmp16) {
tmp20 = null;
}
let tmp21 = tmp20;
if (null != lastActiveStream) {
tmp21 = tmp20;
if (null == tmp20) {
const participant1 = obj.getParticipant(global, StreamKeyUtils.encodeStreamKey(lastActiveStream));
let id;
if (participant1 != null) {
id = participant1.id;
}
let result1 = null == id;
if (!result1) {
result1 = obj.isParticipantPoppedOut(global, id);
}
tmp21 = tmp20;
if (!result1) {
tmp21 = id;
}
}
}
tmp2 = tmp21;
if (null == tmp21) {
const _Date = Date;
const id1 = AuthenticationStore.getId();
const items = [];
const items1 = [];
const timestamp = Date.now();
const videoParticipants = obj.getVideoParticipants(global);
const iter = videoParticipants[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let tmp34 = nextResult;
if (nextResult.user.id !== id1) {
if (!MediaEngineStore.isLocalVideoDisabled(tmp34.user.id)) {
if (!ChannelRTCStore.isParticipantPoppedOut(global, tmp34.id)) {
let arr = items.push(tmp34.user.id);
let speakingDuration = SpeakingStore.getSpeakingDuration(tmp34.user.id, timestamp);
if (0 !== speakingDuration) {
let obj3 = { userId: null, duration: null };
obj3.userId = tmp34.user.id;
obj3.duration = tmp43;
let arr2 = items1.push(obj3);
}
}
}
}
continue;
}
for (const item10094 of items1) {
let duration = item10094.duration;
let tmp50 = null == tmp;
if (!tmp50) {
tmp50 = duration < tmp;
}
if (tmp50) {
userId = item10094.userId;
let tmp = duration;
}
continue;
}
tmp2 = userId;
if (null == userId) {
if (null == c3) {
const first = items[0];
}
}
}
}
if (c3 !== tmp2) {
c3 = tmp2;
if (flag) {
videoSpeakerStoreClass.emitChange();
}
}
}
function handleChannelRTCUpdate() {
closure_11();
return false;
}
const ParticipantTypes = fn(4779).ParticipantTypes;
let closure_11 = apply.throttle(updateSpeaker, 300, { trailing: true });
const Store = initializeDefault.Store;
class VideoSpeakerStoreClass extends Store {
}
const prototype = VideoSpeakerStoreClass.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(ChannelRTCStore, AuthenticationStore, SpeakingStore, ApplicationStreamingStore, MediaEngineStore);
const items = [ChannelRTCStore, ApplicationStreamingStore];
this.syncWith(items, handleChannelRTCUpdate);
};
prototype["getSpeaker"] = function getSpeaker(arg0) {
if (global !== arg0) {
global = arg0;
c3 = null;
updateSpeaker(false);
}
let id = c3;
if (c3 == null) {
id = AuthenticationStore.getId();
}
return id;
};
VideoSpeakerStoreClass.displayName = "VideoSpeakerStore";
const videoSpeakerStoreClass = new VideoSpeakerStoreClass(DispatcherDefault, { AUDIO_SET_LOCAL_VIDEO_DISABLED: handleChannelRTCUpdate });
const size = fn(2);
let result = size.fileFinishedImporting("modules/calls/VideoSpeakerStore.tsx");
export default videoSpeakerStoreClass;