react native web view microphone allways using

Hello everyone, I have a microphone problem with react-native-web-view. I asked for all permissions but am told that the microphone is still in use. I use SDK 48.

my app.js

import React, { useState, useRef, useEffect } from “react”;
import { StyleSheet, Modal, View, BackHandler, Platform } from “react-native”;
import WebView from “react-native-webview”;
import { Chase } from “react-native-animated-spinkit”;
import { StatusBar } from “react-native”;
import OneSignal from “react-native-onesignal”;
import * as SplashScreen from “expo-splash-screen”;
import “react-native-get-random-values”;
import { Camera } from “expo-camera”;

export default function App() {
const [open, setOpen] = useState(false);
const [openSplast, setOpenSplast] = useState(true);
const webViewRef = useRef();
const [notOpen, setNotOpen] = useState(false);
const [permission, requestPermission] = Camera.useCameraPermissions();
const [permissionMicro, requestPermissionMicro] =
Camera.useMicrophonePermissions();
const handleNavigation = (event) => {
const { url } = event;
if (
url.match(
https://iccinside.com/membres/[a-zA-Z]+/bp-messages/#/conversation/*”
) &&
Platform.OS == “ios”
) {
setNotOpen(true);
return true;
} else setNotOpen(false);
const blockedKeyword = “wp-admin”; // Mot-clé à bloquer
const redirectURL = “https://iccinside.com/fil-dactualites”;
if (Platform.OS == “android”) setOpen(true);
try {
const pathname = url.split(“/”)[3];
if (pathname == blockedKeyword) {
webViewRef.current.stopLoading();
webViewRef.current.injectJavaScript(
window.location.href = '${redirectURL}';
);
return false;
}
} catch (error) {
console.error(“Erreur lors de l’analyse de l’URL :”, error);
}
return true;
};
useEffect(() => {
(async () => {
if (!permission?.granted) await requestPermission();
if (!permissionMicro?.granted) await requestPermissionMicro();
})();
}, [permission, permissionMicro]);
useEffect(() => {
OneSignal.setAppId(“a11cb272-86cd-4685-94ff-c393e91bf511”);
}, );
useEffect(() => {
if (open) {
setOpenSplast(false);
}
}, [open]);

useEffect(() => {
if (openSplast) {
SplashScreen.preventAutoHideAsync();
setOpen(false);
} else {
SplashScreen.hideAsync();
}
}, [openSplast]);
OneSignal.promptForPushNotificationsWithUserResponse();
const handleBackPress = () => {
if (webViewRef.current) {
webViewRef.current.goBack();
return true;
}
return false;
};
useEffect(() => {
BackHandler.addEventListener(“hardwareBackPress”, handleBackPress);
return () => {
BackHandler.addEventListener(“hardwareBackPress”, handleBackPress);
};
}, );
return (
<View style={{ flex: 1, marginTop: Platform.OS == “ios” ? 30 : 0 }}>
<StatusBar backgroundColor={“#201A3E”} />

<View
style={{
flex: 1,
justifyContent: “center”,
alignItems: “center”,
backgroundColor: “rgba(0,0,0,0.1)”,
}}
>



<WebView
onLoadEnd={() => setOpen(false)}
onLoadStart={() => {
if (!notOpen) setOpen(true);
}}
onMessage={(e) => console.log(e)}
allowsInlineMediaPlayback={true}
allowsAirPlayForMediaPlayback
onShouldStartLoadWithRequest={handleNavigation}
mediaPlaybackRequiresUserAction={false}
source={{ uri: “https://iccinside.com/connexion” }}
style={{ flex: 1 }}
ref={webViewRef}
/>

);
// https://iccinside.com/connexion
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: “#fff”,
alignItems: “center”,
justifyContent: “center”,
},
});

my package.json

{
“name”: “lambano-web-view”,
“version”: “1.0.0”,
“main”: “node_modules/expo/AppEntry.js”,
“scripts”: {
“start”: “expo start”,
“android”: “expo start --android”,
“ios”: “expo start --ios”,
“web”: “expo start --web”
},
“dependencies”: {
“expo”: “~48.0.18”,
“expo-app-loading”: “^2.1.1”,
“expo-camera”: “^13.2.1”,
“expo-dev-client”: “~2.2.1”,
“expo-notifications”: “^0.18.1”,
“expo-splash-screen”: “^0.18.2”,
“expo-status-bar”: “~1.4.4”,
“onesignal-expo-plugin”: “^1.3.2”,
“react”: “18.2.0”,
“react-native”: “0.71.8”,
“react-native-animated-spinkit”: “^1.5.2”,
“react-native-get-random-values”: “~1.8.0”,
“react-native-indicator”: “^1.2.2”,
“react-native-onesignal”: “^4.5.1”,
“react-native-webview”: “^13.3.1”
},
“devDependencies”: {
@babel/core”: “^7.20.0”
},
“private”: true
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.