- APP页面
<template> <view> <web-view src="https://xxx"></web-view> </view> </template> - web-view 打开的页面
<!DOCTYPE html> <html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<video id="video" controls autoplay muted></video>
<script>
navigator.mediaDevices
.getUserMedia({
video: {
facingMode: {exact: 'environment'},
width: 123,
height: 456
}
})
.then((stream) => {
document.querySelector('#video').srcObject = stream
}).catch((error) => {
console.error(error)
})
</script>
</body>
</html>
0 个回复