【发布时间】:2018-10-11 11:22:13
【问题描述】:
我有以下代码可以在我的 Google Chrome 浏览器中流式传输连接的视频源。 WebRTC 的getUserMedia 就是这样做的。以下代码 sn -p 用于配置我的外接摄像头设备的分辨率和帧率。
function configureVideo()
{
const video_constraints ={};
//Create the following keys for Constraint
video_constraints.video = {};
//set camera name
video_constraints.video.deviceId = {};
video_constraints.video.deviceId.exact = <device_id_comes_here>
//set resolution Width
video_constraints.video.width = {};
video_constraints.video.width.exact = 640;
//set resolution height
video_constraints.video.height = 480;
video_constraints.video.height.exact = streamHeight;
//set fps
video_constraints.video.frameRate = 60;
video_constraints.video.frameRate.exact = streamFps;
console.log("Selected Contraints is :", video_constraints);
navigator.mediaDevices.getUserMedia(video_constraints).then(streamCallback).catch(handleError);
}
是的,我成功地能够从我的外部相机设备流式传输视频。相机提供 2 种帧格式 YUYV 和 BY8。但我真的不知道目前正在流式传输什么帧格式。
有什么方法可以在 WebRTC 中配置我感兴趣的视频帧格式。
【问题讨论】:
-
谁能帮我解决这个问题。我仍在寻找解决方案。
-
我在下面添加了一个答案。希望对你有帮助
标签: javascript video-streaming webrtc getusermedia