[英]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:我测试它:
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.