when i route app to external website camera stream preview work only when touching
android
private void loadWebView() {
// ...
webView.loadUrl("https://mysite.com/");
}
on mysite.com
js
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<body>
<video id="stream" autoplay playsinline width="200" height="200"></video>
</body>
</html>
<script type="text/javascript">
navigator.mediaDevices.getUserMedia({video: true}).then((stream) => {
document.getElementById('stream').srcObject = stream;
});
</script>
on localhost all fine