Html 如何使用 Html5 从我的网络摄像头广播视频?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9506145/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 22:51:49  来源:igfitidea点击:

How do I broadcast video from my webcam with Html5?

htmlhtml5-videowebcambroadcastwebrtc

提问by yildirimyigit

I am trying to build a simple web page that has access to my webcam and is able to broadcast the video taken from my webcam.

我正在尝试构建一个可以访问我的网络摄像头并能够广播从我的网络摄像头拍摄的视频的简单网页。

I am new to Html5 and I suppose that it is a complex task to build such a web page from scratch. I just want some experienced Html5 developers to provide me with some starting point, maybe some tutorials in this matter.

我是 Html5 的新手,我认为从头开始构建这样的网页是一项复杂的任务。我只是希望一些有经验的 Html5 开发人员为我提供一些起点,也许是这方面的一些教程。

采纳答案by Lloyd

Native (not Flash) Webcam and Microphone access in Chrome, demonstrated on YouTubeby Paul Kinlan (Google):

Chrome 中的原生(非 Flash)网络摄像头和麦克风访问,由 Paul Kinlan(谷歌)在 YouTube 上演示

And check this out too: Hands on: building an HTML5 photo booth with Chrome's new webcam API

也请检查一下:动手:使用 Chrome 的新网络摄像头 API 构建 HTML5 照相亭

回答by cupcakes4life

Not possible in HTML5 yet. You would need to use some sort of browser plugin like flash.

在 HTML5 中尚不可能。您需要使用某种浏览器插件,例如 flash。

See this question: What's the status of the HTML 5 <video> tag and webcam integration?

看到这个问题:HTML 5 <video> 标签和网络摄像头集成的状态是什么?

回答by Muaz Khan

Broadcasting in WebRTCis not yet possibleaccording to this Google Developers Video.

广播的WebRTC没有可能根据这个谷歌开发者视频

What you can do:

你可以做什么:

  1. Share your screen

  2. Share static stuff (e.g. images, files, etc.) via DataChannels

  3. Connect with group of people or individual and share your streams(audio + video)

  1. 共享您的屏幕

  2. 通过 DataChannels 共享静态内容(例如图像、文件等)

  3. 与一群人或个人联系并分享您的流(音频 + 视频)

回答by Martijn

Make sure your webcam is behind software that can stream H264 over HTTP (look up at w3schools.comor so) and use the <video>tag and point it to your PC (open ports if you are behind NAT, common is 8080 but that is depending on your streaming software).

确保您的网络摄像头位于可以通过 HTTP 流式传输 H264 的软件后面(查看w3schools.com左右)并使用<video>标签并将其指向您的 PC(如果您位于 NAT 后面,则打开端口,常见的是 8080,但这取决于您的流媒体软件)。

Point the source tag (NOT SRC in the video tag, some browsers hate that) to your external IP and port.

将源标签(不是视频标签中的 SRC,有些浏览器讨厌它)指向您的外部 IP 和端口。