decord/source/modules/go_live/useFetchStreamPreview.tsx

86 lines
3 KiB
TypeScript
Raw Normal View History

// Module ID: 10067
// Function ID: 10068
2026-07-20 16:05:17 +00:00
// Name: useFetchStreamPreview
// Dependencies: [19, 4704, 1957, 4199, 2011, 1085, 504, 4702, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 10067 (useFetchStreamPreview)
2026-08-24 06:08:38 +00:00
import closure_2 from "noop" /* 19 */;
import closure_3 from "reset" /* 4704 */;
import closure_4 from "ensureGuildLoaded" /* 1957 */;
import closure_5 from "getUncachedChannelPermissions" /* 4199 */;
import closure_6 from "handleConnectionOpen" /* 2011 */;
import { BasicPermissions } from "sum" /* 1085 */;
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/go_live/useFetchStreamPreview.tsx");
2026-07-20 16:05:17 +00:00
export default function useFetchStreamPreview(arg0, arg1, arg2) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-08-24 06:08:38 +00:00
dependencyMap = arg1;
2026-07-20 16:05:17 +00:00
const React = arg2;
2026-08-24 06:08:38 +00:00
closure_3 = tmp;
let obj = _require(504);
2026-08-24 06:08:38 +00:00
const items = [closure_4];
closure_4 = obj.useStateFromStores(items, () => channel.getChannel(closure_1));
2026-07-23 10:11:24 +00:00
const items1 = [shouldFetchPreview];
let stateFromStores = _require(504).useStateFromStores(items1, () => {
2026-08-24 06:08:38 +00:00
let canBasicChannelResult = null != closure_4;
2026-07-20 16:05:17 +00:00
if (canBasicChannelResult) {
2026-08-24 06:08:38 +00:00
canBasicChannelResult = shouldFetchPreview.canBasicChannel(closure_1_7.CONNECT, tmp);
2026-07-20 16:05:17 +00:00
}
return canBasicChannelResult;
});
const obj2 = _require(504);
2026-07-23 10:11:24 +00:00
const items2 = [stateFromStores];
const stateFromStores1 = _require(504).useStateFromStores(items2, () => stateFromStores.getVoiceChannelId() === closure_1);
const obj3 = _require(504);
2026-08-24 06:08:38 +00:00
const items3 = [closure_3];
const stateFromStoresObject = _require(504).useStateFromStoresObject(items3, () => {
2026-08-24 06:08:38 +00:00
let isPreviewLoading = !store;
2026-07-29 08:29:29 +00:00
let shouldFetchPreviewResult = isPreviewLoading;
2026-08-24 06:08:38 +00:00
if (!store) {
shouldFetchPreviewResult = store.shouldFetchPreview(closure_0, closure_1, closure_2);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj = { shouldFetchPreview: shouldFetchPreviewResult, previewUrl: null, isLoading: null };
2026-07-20 16:05:17 +00:00
let previewURL = null;
2026-08-24 06:08:38 +00:00
if (!store) {
previewURL = store.getPreviewURL(closure_0, closure_1, closure_2);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = previewURL;
2026-08-24 06:08:38 +00:00
if (!store) {
isPreviewLoading = store.getIsPreviewLoading(closure_0, closure_1, closure_2);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = isPreviewLoading;
2026-07-20 16:05:17 +00:00
return obj;
});
2026-07-23 10:11:24 +00:00
shouldFetchPreview = stateFromStoresObject.shouldFetchPreview;
2026-07-20 16:05:17 +00:00
({ previewUrl, isLoading } = stateFromStoresObject);
if (!stateFromStores) {
stateFromStores = stateFromStores1;
}
const items4 = [shouldFetchPreview, arg1, arg0, arg2, null == arg1 || null == arg2, stateFromStores];
const effect = React.useEffect(() => {
let tmp = shouldFetchPreview;
if (shouldFetchPreview) {
2026-08-24 06:08:38 +00:00
tmp = !closure_3;
2026-07-20 16:05:17 +00:00
}
if (tmp) {
tmp = stateFromStores;
}
if (tmp) {
2026-08-24 06:08:38 +00:00
const streamPreview = callback(table[7]).fetchStreamPreview(callback, table, closure_2);
2026-07-23 10:11:24 +00:00
const obj = callback(table[7]);
2026-07-20 16:05:17 +00:00
}
}, items4);
if (!(null == arg1 || null == arg2)) {
if (stateFromStores) {
2026-07-29 08:29:29 +00:00
obj = { previewUrl: null, isLoading: null };
obj[0] = previewUrl;
obj[1] = isLoading;
2026-07-20 16:05:17 +00:00
}
return obj;
}
2026-09-02 09:53:35 +00:00
obj = { previewUrl: "PX_16", isLoading: true };
2026-07-20 16:05:17 +00:00
};