我使用以下方式在Angular2应用程序(最新版本)中显示用户网络摄像头:
nav.getUserMedia(
{video: true},
(stream) => {
let webcamUrl = URL.createObjectURL(stream);
// 4a. Tell Angular the stream comes from a trusted source
this.videosrc = this.sanitizer.bypassSecurityTrustUrl(webcamUrl);
// 4b. Start video element to stream automatically from webcam.
this.element.nativeElement.querySelector('video').autoplay = true;
},
(err) => console.log(err));
并在模板中:
<video [src]="videosrc"></video>
这一切都运行正常,但我如何捕获显示的base64图像数据以发布到服务器?