decord/source/modules/voice_calls/VoicePermissionManager.tsx
github-actions ecf26fc058 chore: update source for alpha 347.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
2026-09-16 07:03:15 +00:00

103 lines
4.5 KiB
TypeScript

// Module ID: 17525
// Function ID: 17526
// Name: VoicePermissionManager
// Dependencies: [5507, 4658, 502, 1958, 1909, 4661, 1074, 4848, 5224, 17526, 4785, 7228, 2]
// Exports: shouldImmediatelyRequestVoicePermissions
// Module 17525 (VoicePermissionManager)
import useAudienceRequestToSpeakState from "useAudienceRequestToSpeakState" /* 4785 */;
import NativePermissionUtilsDefault from "NativePermissionUtils" /* 5224 */;
import StageChannelRoleStore from "StageChannelRoleStore" /* 5507 */;
import VoiceStateRecord from "VoiceStateRecord" /* 4658 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import ChannelStore from "ChannelStore" /* 1958 */;
import MediaEngineStore from "MediaEngineStore" /* 1909 */;
import RTCConnectionStore from "RTCConnectionStore" /* 4661 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7228 */;
require = fn;
const InputModes = fn(1074).InputModes;
const NativePermissionTypes = fn(4848).NativePermissionTypes;
let c11 = null;
class VoicePermissionManager extends tmp2 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
applyArgumentsResult.actions = { VOICE_STATE_UPDATES: applyArgumentsResult.handleVoiceStateUpdates, VOICE_CHANNEL_SELECT: applyArgumentsResult.handleVoiceChannelSelect };
return applyArgumentsResult;
}
}
const prototype = VoicePermissionManager.prototype;
prototype["handleVoiceChannelSelect"] = function handleVoiceChannelSelect(channelId) {
if (null == channelId.channelId) {
c11 = null;
}
};
prototype["handleVoiceStateUpdates"] = function handleVoiceStateUpdates(voiceStates) {
voiceStates = voiceStates.voiceStates;
const item = voiceStates.forEach((item) => {
({ userId, channelId } = item);
if (null != channelId) {
if (id.getId() === userId) {
if (null != rTCConnectionId.getRTCConnectionId()) {
if (channelId !== channelId) {
channel = channel.getChannel(channelId);
let isListenModeCapableResult;
if (channel != null) {
isListenModeCapableResult = channel.isListenModeCapable();
}
let isSpeakerResult = !isListenModeCapableResult;
if (isListenModeCapableResult) {
isSpeakerResult = speaker.isSpeaker(userId, channelId);
}
if (isSpeakerResult) {
const permission = NativePermissionUtilsDefault.requestPermission(constants2.AUDIO);
permission.then((result) => {
if (result) {
closure_1_1(dependencyMap[9])(true);
}
});
if (MediaEngineStore.getMode() === constants.PUSH_TO_TALK) {
const permission1 = NativePermissionUtilsDefault.requestPermission(constants2.INPUT_MONITORING);
const tmp19Result = NativePermissionUtilsDefault;
}
} else {
const tmp8 = new VoiceStateRecord(item);
const audienceRequestToSpeakState = useAudienceRequestToSpeakState.getAudienceRequestToSpeakState(tmp8);
if (audienceRequestToSpeakState === useAudienceRequestToSpeakState.RequestToSpeakStates.REQUESTED_TO_SPEAK_AND_AWAITING_USER_ACK) {
const permission2 = NativePermissionUtilsDefault.requestPermission(constants2.AUDIO);
permission2.then((result) => {
if (result) {
closure_1_1(dependencyMap[9])(true);
}
});
if (MediaEngineStore.getMode() === constants.PUSH_TO_TALK) {
const permission3 = tmp13(5224).requestPermission(tmp14.INPUT_MONITORING);
const tmp13Result = tmp13(5224);
}
tmp13 = importDefault;
tmp14 = constants2;
}
}
}
}
}
}
});
};
const voicePermissionManager = new VoicePermissionManager();
const size = fn(2);
const result = size.fileFinishedImporting("modules/voice_calls/VoicePermissionManager.tsx");
export default voicePermissionManager;
export const shouldImmediatelyRequestVoicePermissions = function shouldImmediatelyRequestVoicePermissions(id, id2) {
const channel = ChannelStore.getChannel(id2);
let isListenModeCapableResult;
if (channel != null) {
isListenModeCapableResult = channel.isListenModeCapable();
}
let isSpeakerResult = !isListenModeCapableResult;
if (isListenModeCapableResult) {
isSpeakerResult = StageChannelRoleStore.isSpeaker(id, id2);
}
return isSpeakerResult;
};