【发布时间】:2020-02-26 04:43:12
【问题描述】:
我在这里看到了这个教程: https://github.com/mdn/samples-server/blob/master/s/webrtc-capturestill/capture.js
但是我在将它实现到我的代码中时遇到了麻烦,正在寻求一些帮助...
我基本上想要一个面板,您可以在其中按下“拍照”按钮。这将打开一个新的浮动面板,其中网络摄像头的实时流将自动启动,并且您有一个捕获图像的按钮。
takePicture: function (photoPanel)
{
let me = this;
let capture = Ext.create('Ext.panel.Panel', {
title: 'Take Picture',
height: 500,
width: 750,
draggable: true,
closable: true,
floating: true,
layout: {
type: 'vbox',
pack: 'center',
align: 'middle'
},
items: [
{
xtype: 'container',
itemId: 'video',
height: 400,
width: 350
// this is where I want the live webcam to stream
},
{
xtype: 'button',
text: 'Take Picture',
itemId: 'startbutton',
handler: function (btn)
{
}
// button to capture the image
}
]
});
photoPanel.add(capture).show();
},
【问题讨论】:
-
你试过什么?问题出在哪里 ?在
takePicture函数中,您需要启动getUserMedia并将流回调设置为video容器。在startbutton按钮上,您只需从流中创建画布。
标签: javascript extjs webcam