decord/source/modules/video_calls/native/usePipVideoOrStream.tsx
github-actions e510164e6b chore: update source for alpha 346.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
2026-09-10 05:38:07 +00:00

272 lines
9.4 KiB
TypeScript

// Module ID: 9522
// Function ID: 9523
// Name: usePipVideoOrStream
// Dependencies: [1956, 4590, 9523, 4596, 502, 1957, 1908, 4597, 4595, 504, 4626, 4431, 9498, 2]
// Exports: default, useHasPipParticipant
// Module 9522 (usePipVideoOrStream)
import NavigationRouteUtils from "NavigationRouteUtils" /* 4431 */;
import ChannelCallModalDefault from "ChannelCallModal" /* 9498 */;
import EmbeddedActivitiesStore from "EmbeddedActivitiesStore" /* 1956 */;
import ChannelRTCStore from "ChannelRTCStore" /* 4590 */;
import VideoSpeakerStore from "VideoSpeakerStore" /* 9523 */;
import ApplicationStreamingStore from "ApplicationStreamingStore" /* 4596 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import MediaEngineStore from "MediaEngineStore" /* 1908 */;
import RTCConnectionStore from "RTCConnectionStore" /* 4597 */;
const require = globalThis.__r;
require = fn;
const CallConstants = fn(4595);
({ isStreamParticipant: closure_11, isUserParticipant: closure_12, ParticipantTypes: map1 } = CallConstants);
const size = fn(2);
const result = size.fileFinishedImporting("modules/video_calls/native/usePipVideoOrStream.tsx");
export default function usePipVideoOrStream(arg0) {
_require = arg0;
const items = [ChannelRTCStore, VideoSpeakerStore, ApplicationStreamingStore];
const items1 = [arg0];
return require("initialize").useStateFromStores(items, () => {
if (null != isActivityViewFocused) {
let videoParticipants = ChannelRTCStore.getVideoParticipants(tmp);
} else {
videoParticipants = [];
}
let selectedParticipant = null;
if (null != isActivityViewFocused) {
selectedParticipant = ChannelRTCStore.getSelectedParticipant(tmp);
}
const found = videoParticipants.find((type) => type.type === constants.USER && !type.localVideoDisabled);
if (null != isActivityViewFocused) {
let videoParticipants1 = obj2.getVideoParticipants(tmp);
} else {
videoParticipants1 = [];
}
let participant = null;
const found1 = videoParticipants1.find((id) => {
let tmp = id.id !== id.getId();
if (tmp) {
const tmp3 = closure_1_12(id);
let localVideoDisabled = !tmp3;
if (tmp3) {
localVideoDisabled = id.localVideoDisabled;
}
tmp = localVideoDisabled;
}
return tmp;
});
if (null != isActivityViewFocused) {
participant = obj2.getParticipant(tmp, VideoSpeakerStore.getSpeaker(tmp));
}
if (participant == null) {
participant = found1;
}
let tmp8 = participant;
if (closure_2_12(participant)) {
let tmp9 = null;
if (!participant.localVideoDisabled) {
tmp9 = participant;
}
tmp8 = tmp9;
}
if (null != isActivityViewFocused) {
let allActiveStreamsForChannel = ApplicationStreamingStore.getAllActiveStreamsForChannel(tmp);
} else {
allActiveStreamsForChannel = [];
}
c0 = tmp8;
let tmp11 = tmp8;
if (closure_2_11(tmp8)) {
if (allActiveStreamsForChannel.filter((streamType) => {
id = undefined;
const obj = isActivityViewFocused(stateFromStores1[10]);
const obj2 = { streamType: streamType.streamType, guildId: streamType.guildId, channelId: streamType.channelId, ownerId: streamType.ownerId };
if (_undefined != null) {
id = _undefined.id;
}
return isActivityViewFocused(stateFromStores1[10]).encodeStreamKey({ streamType: streamType.streamType, guildId: streamType.guildId, channelId: streamType.channelId, ownerId: streamType.ownerId }) === id;
}).length <= 0) {
c0 = undefined;
}
tmp11 = tmp8;
}
let tmp12 = tmp11;
if (tmp11 == null) {
tmp12 = found;
}
let isModalOpenResult = null != selectedParticipant;
if (isModalOpenResult) {
let id;
if (tmp11 != null) {
id = tmp11.id;
}
isModalOpenResult = selectedParticipant.id === id;
}
if (isModalOpenResult) {
isModalOpenResult = null != tmp12;
}
if (isModalOpenResult) {
let id1;
if (tmp11 != null) {
id1 = tmp11.id;
}
isModalOpenResult = tmp12.id === id1;
}
if (isModalOpenResult) {
isModalOpenResult = NavigationRouteUtils.isModalOpen(ChannelCallModalDefault);
}
if (isModalOpenResult) {
tmp12 = found;
}
let tmp19 = null;
if (null != tmp12) {
tmp19 = null;
if (tmp12.type !== constants.ACTIVITY) {
tmp19 = null;
if (null != tmp12.streamId) {
tmp19 = tmp12;
}
}
}
return tmp19;
}, items1);
};
export const useHasPipParticipant = function useHasPipParticipant(isActivityViewFocused) {
isActivityViewFocused = isActivityViewFocused.isActivityViewFocused;
let stateFromStores1;
const items = [RTCConnectionStore];
const stateFromStores = isActivityViewFocused(stateFromStores1[9]).useStateFromStores(items, () => channelId.getChannelId());
closure_129_0 = tmp4;
let obj = isActivityViewFocused(stateFromStores1[9]);
const items1 = [ChannelRTCStore, VideoSpeakerStore, ApplicationStreamingStore];
const items2 = [stateFromStores];
stateFromStores1 = isActivityViewFocused(stateFromStores1[9]).useStateFromStores(items1, () => {
if (null != isActivityViewFocused) {
let videoParticipants = ChannelRTCStore.getVideoParticipants(tmp);
} else {
videoParticipants = [];
}
let selectedParticipant = null;
if (null != isActivityViewFocused) {
selectedParticipant = ChannelRTCStore.getSelectedParticipant(tmp);
}
const found = videoParticipants.find((type) => type.type === constants.USER && !type.localVideoDisabled);
if (null != isActivityViewFocused) {
let videoParticipants1 = obj2.getVideoParticipants(tmp);
} else {
videoParticipants1 = [];
}
let participant = null;
const found1 = videoParticipants1.find((id) => {
let tmp = id.id !== id.getId();
if (tmp) {
const tmp3 = closure_1_12(id);
let localVideoDisabled = !tmp3;
if (tmp3) {
localVideoDisabled = id.localVideoDisabled;
}
tmp = localVideoDisabled;
}
return tmp;
});
if (null != isActivityViewFocused) {
participant = obj2.getParticipant(tmp, VideoSpeakerStore.getSpeaker(tmp));
}
if (participant == null) {
participant = found1;
}
let tmp8 = participant;
if (closure_2_12(participant)) {
let tmp9 = null;
if (!participant.localVideoDisabled) {
tmp9 = participant;
}
tmp8 = tmp9;
}
if (null != isActivityViewFocused) {
let allActiveStreamsForChannel = ApplicationStreamingStore.getAllActiveStreamsForChannel(tmp);
} else {
allActiveStreamsForChannel = [];
}
c0 = tmp8;
let tmp11 = tmp8;
if (closure_2_11(tmp8)) {
if (allActiveStreamsForChannel.filter((streamType) => {
id = undefined;
const obj = isActivityViewFocused(stateFromStores1[10]);
const obj2 = { streamType: streamType.streamType, guildId: streamType.guildId, channelId: streamType.channelId, ownerId: streamType.ownerId };
if (_undefined != null) {
id = _undefined.id;
}
return isActivityViewFocused(stateFromStores1[10]).encodeStreamKey({ streamType: streamType.streamType, guildId: streamType.guildId, channelId: streamType.channelId, ownerId: streamType.ownerId }) === id;
}).length <= 0) {
c0 = undefined;
}
tmp11 = tmp8;
}
let tmp12 = tmp11;
if (tmp11 == null) {
tmp12 = found;
}
let isModalOpenResult = null != selectedParticipant;
if (isModalOpenResult) {
let id;
if (tmp11 != null) {
id = tmp11.id;
}
isModalOpenResult = selectedParticipant.id === id;
}
if (isModalOpenResult) {
isModalOpenResult = null != tmp12;
}
if (isModalOpenResult) {
let id1;
if (tmp11 != null) {
id1 = tmp11.id;
}
isModalOpenResult = tmp12.id === id1;
}
if (isModalOpenResult) {
isModalOpenResult = NavigationRouteUtils.isModalOpen(ChannelCallModalDefault);
}
if (isModalOpenResult) {
tmp12 = found;
}
let tmp19 = null;
if (null != tmp12) {
tmp19 = null;
if (tmp12.type !== constants.ACTIVITY) {
tmp19 = null;
if (null != tmp12.streamId) {
tmp19 = tmp12;
}
}
}
return tmp19;
}, items2);
const tmpResult = isActivityViewFocused(stateFromStores1[9]);
const items3 = [ChannelStore, EmbeddedActivitiesStore, MediaEngineStore];
const items4 = [stateFromStores, stateFromStores1, isActivityViewFocused];
return isActivityViewFocused(stateFromStores1[9]).useStateFromStores(items3, () => {
if (null == ChannelStore.getChannel(stateFromStores)) {
return false;
} else {
let isLocalVideoDisabledResult = null != stateFromStores1;
const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
if (isLocalVideoDisabledResult) {
isLocalVideoDisabledResult = MediaEngineStore.isLocalVideoDisabled(tmp3.id);
}
let tmp6 = null != currentEmbeddedActivity;
if (tmp6) {
tmp6 = !isActivityViewFocused;
}
if (!tmp6) {
tmp6 = null != tmp3 && null != tmp3.streamId && !isLocalVideoDisabledResult;
const tmp8 = null != tmp3 && null != tmp3.streamId && !isLocalVideoDisabledResult;
}
return tmp6;
}
}, items4);
};