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

212 lines
7.7 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 10912
// Function ID: 10913
2026-07-29 08:29:29 +00:00
// Name: stopScreenshare
2026-08-25 06:04:03 +00:00
// Dependencies: [19, 17, 4402, 4431, 676, 4444, 4359, 7360, 4433, 9296, 4563, 4446, 9303, 9317, 10913, 10908, 1625, 10924, 10925, 10926, 10927, 589, 10919, 5834, 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-25 06:04:03 +00:00
// Module 10912 (stopScreenshare)
import inject from "inject" /* 4433 */;
import isStreamKey from "isStreamKey" /* 4446 */;
import watchStream from "watchStream" /* 4563 */;
import contextDefault from "context" /* 5834 */;
import initializeDefault from "initialize" /* 7360 */;
import _handleToggleVideo from "_handleToggleVideo" /* 9296 */;
import trackDeviceChangedDefault from "trackDeviceChanged" /* 9303 */;
import useHasVideoPermission from "useHasVideoPermission" /* 10908 */;
import useHasVideoPermissionDefault from "useHasVideoPermission" /* 10908 */;
import apexExperimentDefault from "apexExperiment" /* 10919 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "noop" /* 19 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "reset" /* 4402 */;
import closure_5 from "_detectH265HardwareDecode" /* 4431 */;
2026-08-24 06:08:38 +00:00
import { ApplicationStreamStates } from "ME" /* 676 */;
2026-08-25 06:04:03 +00:00
import { Features } from "DesktopSources" /* 4444 */;
import DCDDeviceManager from "DCDDeviceManager" /* 4359 */;
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-25 06:04:03 +00:00
let tmpResult = tmp(4563);
tmpResult = tmp(4446);
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-25 06:04:03 +00:00
fn = callback(9296).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-25 06:04:03 +00:00
tmp19(tmp ? 10924 : 10925);
2026-07-29 08:29:29 +00:00
} else {
2026-08-14 17:33:39 +00:00
if (tmp4) {
2026-08-25 06:04:03 +00:00
let tmp20 = 10926;
2026-08-14 17:33:39 +00:00
} else {
2026-08-25 06:04:03 +00:00
tmp20 = tmp ? 10927 : 10926;
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
}
};