decord/source/modules/go_live/useFetchStreamPreview.tsx

87 lines
3.3 KiB
TypeScript
Raw Normal View History

// Module ID: 10191
// Function ID: 10192
2026-07-20 16:05:17 +00:00
// Name: useFetchStreamPreview
// Dependencies: [19, 4780, 1957, 4275, 2011, 1085, 504, 4778, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 10191 (useFetchStreamPreview)
import StreamActionCreators from "StreamActionCreators" /* 4778 */;
import noop from "module_19" /* 19 */;
import ApplicationStreamPreviewStore from "ApplicationStreamPreviewStore" /* 4780 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import PermissionStore from "PermissionStore" /* 4275 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
2026-07-20 16:05:17 +00:00
const require = globalThis.__r;
require = fn;
const BasicPermissions = fn(1085).BasicPermissions;
const size = fn(2);
const result = size.fileFinishedImporting("modules/go_live/useFetchStreamPreview.tsx");
2026-07-20 16:05:17 +00:00
export default function useFetchStreamPreview(arg0, arg1, arg2) {
_require = arg0;
2026-08-24 06:08:38 +00:00
dependencyMap = arg1;
noop = arg2;
2026-08-24 06:08:38 +00:00
closure_3 = tmp;
const items = [closure_4];
closure_4 = require("initialize").useStateFromStores(items, () => ChannelStore.getChannel(closure_1));
let obj = require("initialize");
2026-07-23 10:11:24 +00:00
const items1 = [shouldFetchPreview];
let stateFromStores = require("initialize").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) {
canBasicChannelResult = PermissionStore.canBasicChannel(BasicPermissions.CONNECT, tmp);
2026-07-20 16:05:17 +00:00
}
return canBasicChannelResult;
});
const obj2 = require("initialize");
2026-07-23 10:11:24 +00:00
const items2 = [stateFromStores];
const stateFromStores1 = require("initialize").useStateFromStores(items2, () => SelectedChannelStore.getVoiceChannelId() === closure_1);
const obj3 = require("initialize");
2026-08-24 06:08:38 +00:00
const items3 = [closure_3];
const stateFromStoresObject = require("initialize").useStateFromStoresObject(items3, () => {
let isPreviewLoading = !closure_3;
2026-07-29 08:29:29 +00:00
let shouldFetchPreviewResult = isPreviewLoading;
if (!closure_3) {
shouldFetchPreviewResult = ApplicationStreamPreviewStore.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;
if (!closure_3) {
previewURL = ApplicationStreamPreviewStore.getPreviewURL(closure_0, closure_1, closure_2);
2026-07-20 16:05:17 +00:00
}
obj.previewUrl = previewURL;
if (!closure_3) {
isPreviewLoading = ApplicationStreamPreviewStore.getIsPreviewLoading(closure_0, closure_1, closure_2);
2026-07-20 16:05:17 +00:00
}
obj.isLoading = 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 = noop.useEffect(() => {
2026-07-20 16:05:17 +00:00
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) {
const streamPreview = StreamActionCreators.fetchStreamPreview(closure_0, closure_1, closure_2);
2026-07-20 16:05:17 +00:00
}
}, items4);
if (!(null == arg1 || null == arg2)) {
if (stateFromStores) {
let obj5 = { previewUrl, isLoading };
2026-07-20 16:05:17 +00:00
}
return obj5;
2026-07-20 16:05:17 +00:00
}
obj5 = { previewUrl: "PX_16", isLoading: true };
2026-07-20 16:05:17 +00:00
};