我有这段代码可以输入相机并将其显示在网络浏览器窗口中(仅在从网络服务器提供服务时才有效,而不是直接通过打开文件):
<html>
<body>
<video id="video" width="640" height="480" autoplay="true"></video>
<script>
var video = document.getElementById('video');
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({video: true}).then(function (stream) {
video.src = window.URL.createObjectURL(stream);
video.play();
});
}
</script>
</body>
</html>
我想将视频直播到一个 URL(例如:到 "/publish/?password=" 如https://github.com/vbence/stream-m)
我该如何编码?
谢谢!