我正在尝试构建一个客户端服务器架构,我正在使用 getUserMedia() 从用户的网络摄像头捕获实时视频。现在不是直接在<video>标签中显示视频,我想将它发送到我的烧瓶服务器,对帧进行一些处理并将其扔回我的网页。
我使用 socketio 来创建客户端-服务器连接。这是我的index.html 中的脚本。请原谅我的错误或任何错误的代码。
<div id="container">
<video autoplay="true" id="videoElement">
</video>
</div>
Run Code Online (Sandbox Code Playgroud)
<script type="text/javascript" charset="utf-8">
var socket = io('http://127.0.0.1:5000');
// checking for connection
socket.on('connect', function(){
console.log("Connected... ", socket.connected)
});
var video = document.querySelector("#videoElement");
// asking permission to access the system camera of user, capturing live
// video on getting true.
if (navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ video: true })
.then(function (stream) {
// instead of showing it directly in <video>, I want to send these frame …Run Code Online (Sandbox Code Playgroud)