CodePudding
Home
front end
Back-end
Net
Software design
Enterprise
Blockchain
Mobile
Software engineering
database
OS
other
Home
>
front end
> On the web for ios camera problems, seek guidance
On the web for ios camera problems, seek guidance
Time:10-09
As shown in figure, allows you to use the camera after page did not show, don't know why
CodePudding user response:
<meta charset="utf-8" & gt;
Document
<body>
Window. The addEventListener (" DOMContentLoaded ", function () {
Var canvas=document. GetElementById (" canvas "),
The context=canvas. GetContext (" 2 d "),
Video=document. GetElementById (" video "),
VideoObj={" video ": true},
ErrBack=function (error) {
The console. The log (" Video capture the error: ", the error. The code).
};
If (the navigator. GetUserMedia) {
The navigator. GetUserMedia (videoObj, function (stream) {
Video. SRC=https://bbs.csdn.net/topics/stream;
Video. The play ();
}, errBack);
{} else if (the navigator webkitGetUserMedia)
The navigator. WebkitGetUserMedia (videoObj, function (stream) {
Video. SRC=https://bbs.csdn.net/topics/window.webkitURL.createObjectURL (stream);
Video. The play ();
}, errBack);
}
Else if (the navigator. MozGetUserMedia) {
The navigator. MozGetUserMedia (videoObj, function (stream) {
Video. SRC=https://bbs.csdn.net/topics/window.URL.createObjectURL (stream);
Video. The play ();
}, errBack);
}
}, false);
</script>