通过向浏览器发送视频来模拟网络摄像头 [英] Simulate a webcam by sending video to the browser
问题描述
我正在进行一项自动化测试,我向 Chrome 提供了一些参数,以尝试发送模拟网络摄像头捕获的视频.
I'm working on an automated test where I provide some parameters to Chrome in an attempt to send a video that simulates a webcam capture.
事实证明一切正常,但一段时间以来,视频开始仅显示为黑色背景,没有图像.
It turns out that everything was working, but for some time now, the video started to be displayed only as a black background, with no image.
我不知道这是不是巧合,但它发生在上次浏览器更新之后.
I don't know if it's a coincidence, but it happened after the last browser update.
有没有人给我提示?
使用的参数如下.
--use-fake-ui-for-media-stream--use-fake-device-for-media-stream--use-file-for-fake-video-capture
--use-fake-ui-for-media-stream --use-fake-device-for-media-stream --use-file-for-fake-video-capture
视频格式为 mjpeg@
the video format is mjpeg@
推荐答案
我遇到了类似的问题,这可能对您有所帮助.
I had similar problem, this might help you.
ChromeOptions options = new ChromeOptions();
options.AddArgument("--use-fake-ui-for-media-stream");
options.AddArgument("--use-fake-device-for-media-stream");
options.AddArgument("--use-file-for-fake-video-capture=filePath.y4m");
options.AddUserProfilePreference("profile.default_content_setting_values.media_stream_camera", 1);
.y4m 格式的文件可能会解决您的问题,猜测值得一试.
File in .y4m format might resolve your problem, guess it's worth to take a shoot.
这篇关于通过向浏览器发送视频来模拟网络摄像头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!