简体   繁体   English

Firefox canvas.captureStream 捕获处于非活动状态的黑帧

[英]Firefox canvas.captureStream captures black frames as was inactive

I'm trying to create a singature pad with https://github.com/szimek/signature_pad , capture the stream of the canvas and create a video of the signature from it.我正在尝试使用https://github.com/szimek/signature_pad创建一个签名板,捕获 ZFCC790C72A86190DE1B549D0DDC6F55C 的 stream 的 stream 并从中创建签名的视频。 In Chrome works like a charm but in Firefox captures black frames instead (like if the MediaRecoder was inactive or muted).在 Chrome 中工作就像一个魅力,但在 Firefox 中捕获黑帧(就像 MediaRecoder 处于非活动状态或静音时一样)。

I made a StackBlitz demo: https://stackblitz.com/edit/js-kbbicy我做了一个 StackBlitz 演示: https://stackblitz.com/edit/js-kbbicy

You can draw in the first canvas and when you press the "Make Video" button Firefox reproduces a black screen video.您可以在第一个 canvas 中绘制,当您按下“制作视频”按钮时 Firefox 再现黑屏视频。

I test it in:我测试它:

  • FireFox 78.0.2 for Linux: Black Frames FireFox 78.0.2 用于 Linux:黑框
  • Chromium 84.0.4 for Linux: Work well Linux 的 Chromium 84.0.4:运行良好
  • Chrome 84.0.4147 for Linux: Works well Linux 的 Chrome 84.0.4147:运行良好

The problem is simply that Firefox can't record transparent videos, so all the transparent background is converted to black in the video.问题很简单,Firefox无法录制透明视频,所以视频中的透明背景全部转换为黑色。

Simply set a white background to your SignaturePad:只需为您的 SignaturePad 设置白色背景:

signaturePad = new SignaturePad(canvas, {
  backgroundColor: "white"
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 <video>使用 MediaRecorder() 从<canvas>使用 canvas.captureStream() 在 firefox、chrome 上呈现不同 - <video> playback of recorded stream using MediaRecorder() from <canvas> using canvas.captureStream() renders differently at firefox, chromium Canvas.captureStream() 在 Angular 8 中不存在 - Canvas.captureStream() does not exist in Angular 8 如何检测何时不支持`canvas.captureStream()`? - How to detect when `canvas.captureStream()` is not supported? 使用 canvas.captureStream() 使用 alpha 通道捕获视频 - Capture video with alpha channel using canvas.captureStream() 将“navigator.mediaDevices.getUserMedia”替换为“canvas.captureStream” - Replace "navigator.mediaDevices.getUserMedia" with "canvas.captureStream" 将drawImage与MediaRecorder一起使用时,为什么canvas.captureStream中的视频为空 - Why is video from canvas.captureStream empty when using drawImage with MediaRecorder 使用captureStream和mediaRecorder进行画布录制 - Canvas recording using captureStream and mediaRecorder firefox捕获来自网络摄像机的视频噪声 - firefox captures video noise from web camera 在画布中动画精灵帧 - Animating sprite frames in canvas html2canvas捕获除内部画布内容以外的所有内容 - html2canvas captures everything except the content of an inner canvas
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM