Closed zhaochg closed 1 month ago
I don't see how navigator.mediaDevices
is it related to the server? I guess, it is purely a WebView problem.
I don't see how
navigator.mediaDevices
is it related to the server? I guess, it is purely a WebView problem.
navigator.mediaDevices must be used in https environment or localhost (127.0.0.1). After react-native-static-server is started, although 127.0.0.1 is used to access the html file, the navigator.mediaDevices method cannot be used.
//This is the configuration of webview
<WebView
style={{ flex: 1 }}
source={{
uri: `xxxx`,
}}
onMessage={handleReceiveMessage}
javaScriptEnabled={true}
domStorageEnabled={true}
mediaPlaybackRequiresUserAction={false}
allowUniversalAccessFromFileURLs={true}
allowsInlineMediaPlayback={true}
originWhitelist={['*']}
allowFileAccess={true}
mixedContentMode="always"
allowsProtectedMedia={true}
allowFileAccessFromFileURLs={true}
/>
But it is WebView who decides whether it allows you to use navigator.mediaDevices
or not, I still don't see any influence of the server on its decision ¯\_(ツ)_/¯
An error (DOMException: Permission denied) occurred in this code. Is there any solution? @birdofpreyru