decord/source/modules/video_calls/native/useScreenshareUtils.tsx

212 lines
7.7 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10970
// Function ID: 10971
2026-07-29 08:29:29 +00:00
// Name: stopScreenshare
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 17, 4658, 4501, 676, 4534, 4358, 7542, 4503, 9686, 9899, 4536, 9693, 9707, 10971, 10969, 1625, 10982, 10983, 10984, 10985, 589, 10977, 7177, 1236, 2]
2026-07-29 08:29:29 +00:00
// Exports: default, getOSRequirement, getStreamPressHandler, handleCloseScreenshare, tryStartScreenShare
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 10970 (stopScreenshare)
import inject from "inject" /* 4503 */;
import isStreamKey from "isStreamKey" /* 4536 */;
import contextDefault from "context" /* 7177 */;
import initializeDefault from "initialize" /* 7542 */;
import _handleToggleVideo from "_handleToggleVideo" /* 9686 */;
import trackDeviceChangedDefault from "trackDeviceChanged" /* 9693 */;
import watchStream from "watchStream" /* 9899 */;
import useHasVideoPermission from "useHasVideoPermission" /* 10969 */;
import useHasVideoPermissionDefault from "useHasVideoPermission" /* 10969 */;
import apexExperimentDefault from "apexExperiment" /* 10977 */;
import closure_3 from "noop" /* 19 */;
import closure_4 from "reset" /* 4658 */;
import closure_5 from "_detectH265HardwareDecode" /* 4501 */;
import { ApplicationStreamStates } from "ME" /* 676 */;
import { Features } from "DesktopSources" /* 4534 */;
import DCDDeviceManager from "DCDDeviceManager" /* 4358 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function stopScreenshare() {
2026-08-24 06:08:38 +00:00
const voiceEngine = inject.getVoiceEngine();
2026-07-20 16:05:17 +00:00
voiceEngine.stopBroadcast();
2026-07-29 08:29:29 +00:00
const currentUserActiveStream = authStore.getCurrentUserActiveStream();
if (null != currentUserActiveStream) {
2026-08-24 06:08:38 +00:00
let tmpResult = tmp(9899);
tmpResult = tmp(4536);
2026-07-29 08:29:29 +00:00
tmpResult.stopStream(tmpResult.encodeStreamKey(currentUserActiveStream));
}
2026-08-24 06:08:38 +00:00
const obj = inject;
trackDeviceChangedDefault.setGoLiveSource(null);
2026-07-20 16:05:17 +00:00
}
function startStream() {
if ("android" === obj.getVoiceEngine().platform) {
2026-08-24 06:08:38 +00:00
const result = initializeDefault.isForegroundServiceRunning((arg0) => {
2026-07-29 08:29:29 +00:00
if (arg0) {
2026-08-14 17:33:39 +00:00
let tmpResult = tmp(tmp2[8]);
2026-07-29 08:29:29 +00:00
const voiceEngine = tmpResult.getVoiceEngine();
voiceEngine.startBroadcast();
} else {
2026-08-14 17:33:39 +00:00
tmpResult = tmp(tmp2[9]);
2026-07-29 08:29:29 +00:00
const result = tmpResult.showScreenshareDisabledAlert();
}
});
2026-08-24 06:08:38 +00:00
const obj2 = initializeDefault;
2026-07-20 16:05:17 +00:00
} else {
BroadcastUploadManager.showPicker();
}
}
2026-08-24 06:08:38 +00:00
const systemVersionMajor = DCDDeviceManager.getSystemVersionMajor();
const BroadcastUploadManager = require("get ActivityIndicator").NativeModules.BroadcastUploadManager;
let result = require("set").fileFinishedImporting("modules/video_calls/native/useScreenshareUtils.tsx");
2026-07-29 08:29:29 +00:00
export default function useScreenshareUtils(arg0) {
const _require = arg0;
2026-08-24 06:08:38 +00:00
let tmp = useHasVideoPermissionDefault(arg0);
2026-07-29 08:29:29 +00:00
importDefault = tmp;
2026-08-24 06:08:38 +00:00
dependencyMap = tmp2;
2026-08-14 17:33:39 +00:00
const items = [stateFromStores1];
const stateFromStores = _require(589).useStateFromStores(items, () => stateFromStores1.supports(constants.VIDEO));
let obj = _require(589);
2026-08-24 06:08:38 +00:00
const showMobileGoLiveUpsell = apexExperimentDefault.useConfig({ location: "useScreenshareUtils" }).showMobileGoLiveUpsell;
let obj2 = apexExperimentDefault;
2026-08-14 17:33:39 +00:00
const items1 = [showMobileGoLiveUpsell];
stateFromStores1 = _require(589).useStateFromStores(items1, () => showMobileGoLiveUpsell.getCurrentUserActiveStream());
2026-08-24 06:08:38 +00:00
const analyticsLocations = contextDefault().analyticsLocations;
const items2 = [stateFromStores1, arg0, stateFromStores, tmp, closure_8 >= 12, showMobileGoLiveUpsell, analyticsLocations];
2026-08-14 17:33:39 +00:00
return stateFromStores.useMemo(() => {
let tmp = null != stateFromStores1;
2026-07-29 08:29:29 +00:00
if (tmp) {
2026-08-14 17:33:39 +00:00
tmp = stateFromStores1.state === analyticsLocations.ACTIVE;
2026-07-29 08:29:29 +00:00
}
2026-08-14 17:33:39 +00:00
let tmp3 = stateFromStores;
if (stateFromStores) {
tmp3 = closure_1;
2026-07-29 08:29:29 +00:00
}
2026-08-14 17:33:39 +00:00
if (tmp3) {
2026-08-24 06:08:38 +00:00
tmp3 = dependencyMap;
2026-08-14 17:33:39 +00:00
}
let obj = { isFeatureEnabled: tmp3, isActive: tmp, text: null, onPress: null, imgSource: null };
2026-07-29 08:29:29 +00:00
if (!showMobileGoLiveUpsell) {
if (tmp) {
2026-08-24 06:08:38 +00:00
const intl = callback(1236).intl;
let stringResult = intl.string(callback(1236).t.CpkXwZ);
2026-07-29 08:29:29 +00:00
}
obj[2] = stringResult;
2026-08-14 17:33:39 +00:00
let flag = tmp4;
if (tmp4 === undefined) {
2026-07-29 08:29:29 +00:00
flag = false;
}
closure_1 = analyticsLocations;
if (tmp12) {
2026-08-14 17:33:39 +00:00
if (tmp11) {
2026-07-29 08:29:29 +00:00
if (flag) {
2026-08-14 17:33:39 +00:00
let fn = function l() {
2026-08-24 06:08:38 +00:00
return lib(closure_1_2[14]).showMobileGoLiveActionSheet(closure_1);
2026-08-14 17:33:39 +00:00
};
2026-07-29 08:29:29 +00:00
} else {
2026-08-14 17:33:39 +00:00
fn = tmp14;
2026-07-29 08:29:29 +00:00
if (tmp) {
2026-08-24 06:08:38 +00:00
fn = closure_1_10;
2026-07-29 08:29:29 +00:00
}
}
} else {
2026-08-24 06:08:38 +00:00
fn = callback(9686).showScreenshareDisabledAlert;
2026-07-29 08:29:29 +00:00
}
} else {
2026-08-14 17:33:39 +00:00
fn = function l() {
2026-08-24 06:08:38 +00:00
let obj = lib(closure_1_2[13]);
obj = { type: lib(closure_1_2[13]).AVError.SCREENSHARE_OS_NOT_SUPPORTED, channelId: lib.id };
2026-08-14 17:33:39 +00:00
obj.reportAVError(obj);
2026-08-24 06:08:38 +00:00
const result = lib(closure_1_2[9]).showMinOSScreenshareRequirementAlert();
2026-08-14 17:33:39 +00:00
};
2026-07-29 08:29:29 +00:00
}
2026-08-14 17:33:39 +00:00
obj[3] = fn;
2026-07-29 08:29:29 +00:00
if (obj2.isMetaQuest()) {
2026-08-24 06:08:38 +00:00
tmp19(tmp ? 10982 : 10983);
2026-07-29 08:29:29 +00:00
} else {
2026-08-14 17:33:39 +00:00
if (tmp4) {
2026-08-24 06:08:38 +00:00
let tmp20 = 10984;
2026-08-14 17:33:39 +00:00
} else {
2026-08-24 06:08:38 +00:00
tmp20 = tmp ? 10985 : 10984;
2026-07-29 08:29:29 +00:00
}
2026-08-14 17:33:39 +00:00
obj[4] = tmp19(tmp20);
2026-07-29 08:29:29 +00:00
return obj;
}
2026-08-24 06:08:38 +00:00
obj2 = callback(1625);
2026-08-14 17:33:39 +00:00
tmp11 = closure_1;
2026-08-24 06:08:38 +00:00
tmp12 = dependencyMap;
2026-07-29 08:29:29 +00:00
const tmp13 = analyticsLocations;
}
2026-08-24 06:08:38 +00:00
const intl2 = callback(1236).intl;
stringResult = intl2.string(callback(1236).t.fjBNo1);
2026-08-14 17:33:39 +00:00
}, items2);
2026-07-29 08:29:29 +00:00
};
export const handleCloseScreenshare = function handleCloseScreenshare() {
const currentUserActiveStream = authStore.getCurrentUserActiveStream();
if (null != currentUserActiveStream) {
2026-08-24 06:08:38 +00:00
const obj = watchStream;
obj.stopStream(isStreamKey.encodeStreamKey(currentUserActiveStream));
const obj2 = isStreamKey;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
trackDeviceChangedDefault.setGoLiveSource(null);
2026-07-29 08:29:29 +00:00
};
export { stopScreenshare };
export { startStream };
export const getOSRequirement = function getOSRequirement() {
2026-08-24 06:08:38 +00:00
return closure_8 >= 12;
2026-07-29 08:29:29 +00:00
};
export const getStreamPressHandler = function getStreamPressHandler(analyticsLocations) {
2026-07-23 10:11:24 +00:00
({ channel: require, showMobileGoLiveUpsell } = analyticsLocations);
2026-07-20 16:05:17 +00:00
({ hasPermission, isActive, osRequirement } = analyticsLocations);
if (showMobileGoLiveUpsell === undefined) {
showMobileGoLiveUpsell = false;
}
2026-07-23 10:11:24 +00:00
analyticsLocations = analyticsLocations.analyticsLocations;
2026-07-20 16:05:17 +00:00
if (osRequirement) {
if (hasPermission) {
if (showMobileGoLiveUpsell) {
2026-08-14 17:33:39 +00:00
let fn = function l() {
2026-08-24 06:08:38 +00:00
return lib(closure_1_2[14]).showMobileGoLiveActionSheet(closure_1);
2026-08-14 17:33:39 +00:00
};
2026-07-20 16:05:17 +00:00
} else {
2026-08-14 17:33:39 +00:00
fn = tmp;
2026-07-20 16:05:17 +00:00
if (isActive) {
2026-08-14 17:33:39 +00:00
fn = stopScreenshare;
2026-07-20 16:05:17 +00:00
}
}
} else {
2026-08-24 06:08:38 +00:00
fn = _handleToggleVideo.showScreenshareDisabledAlert;
2026-07-20 16:05:17 +00:00
}
} else {
2026-08-14 17:33:39 +00:00
fn = function l() {
2026-08-24 06:08:38 +00:00
let obj = lib(closure_1_2[13]);
obj = { type: lib(closure_1_2[13]).AVError.SCREENSHARE_OS_NOT_SUPPORTED, channelId: lib.id };
2026-08-14 17:33:39 +00:00
obj.reportAVError(obj);
2026-08-24 06:08:38 +00:00
const result = lib(closure_1_2[9]).showMinOSScreenshareRequirementAlert();
2026-08-14 17:33:39 +00:00
};
2026-07-20 16:05:17 +00:00
}
2026-08-14 17:33:39 +00:00
return fn;
2026-07-20 16:05:17 +00:00
};
export const tryStartScreenShare = function tryStartScreenShare(channel) {
2026-08-24 06:08:38 +00:00
let videoPermission = closure_8 >= 12;
2026-07-20 16:05:17 +00:00
if (videoPermission) {
2026-08-24 06:08:38 +00:00
videoPermission = useHasVideoPermission.getVideoPermission(channel);
const obj = useHasVideoPermission;
2026-07-20 16:05:17 +00:00
}
if (videoPermission) {
2026-07-29 08:29:29 +00:00
if ("android" === obj2.getVoiceEngine().platform) {
2026-08-24 06:08:38 +00:00
let result = initializeDefault.isForegroundServiceRunning((arg0) => {
2026-07-29 08:29:29 +00:00
if (arg0) {
2026-08-14 17:33:39 +00:00
let tmpResult = tmp(tmp2[8]);
2026-07-29 08:29:29 +00:00
const voiceEngine = tmpResult.getVoiceEngine();
voiceEngine.startBroadcast();
} else {
2026-08-14 17:33:39 +00:00
tmpResult = tmp(tmp2[9]);
2026-07-29 08:29:29 +00:00
const result = tmpResult.showScreenshareDisabledAlert();
}
});
2026-08-24 06:08:38 +00:00
const obj3 = initializeDefault;
2026-07-29 08:29:29 +00:00
} else {
BroadcastUploadManager.showPicker();
}
2026-08-24 06:08:38 +00:00
obj2 = inject;
2026-07-20 16:05:17 +00:00
}
};