开发者

Can html 5 serve real time media stream?

I've heard of many interesting feature开发者_JS百科s of html 5,

but is it able to serve real time media stream from web camera?


Not html5 on it's own but html5 video can read streams(like on youtube, live streaming).

Streaming via RTSP or RTP in HTML5 for some info


HTML5 video is just a tag that looks like

<video src="movie.mp4" controls="controls">
    Your browser doesn't support the video tag.
</video>

(reference here)

Whatever that movie.mp4 actually contains is decided by the underlying server and may be streaming content as long as the format itself supports streaming. For example h.264's eXtended Profile and Scalable High Profile both support video streaming.


I did the proof for this a few days ago. The answer is yes and no. Yes the XMLHttpRequest allows you to access the data while it is streaming from the camera. No it is not supported across all browsers.

In a XMLHttpRequest you can get status messages from the object when done asynchronously. Problem being that each browser handels this a little diffrent. The big problem is that even though Internet Explorer dose support the update to the status if you try to access the data in state 3 it will give an error. For more info please follow the link.

If your camera can send a video stream that is a standard media type like the other posters have been saying then that would be your best option. Maybe after the release of IE 9 will the XMLHttpRequest work as assumed.


This is probably what you are looking for:

http://www.whatwg.org/specs/web-apps/current-work/complete/video-conferencing-and-peer-to-peer-communication.html

Unfortunately I have no idea of browser support at this time and the standard itself appears to be frequently changed.


This has nothing to do with HTML 5, actually. In HTML you just point the browser to a resource, specifying it's video. If your camera emits a stream in a format the browser is able to render, then it should work, sure. Though in my experience many cameras yield MJPEG and support for that directly in browsers appears to be limited at best.


You can use ffmpeg to convert the video real time from the camera format (MJPEG, etc) and then access the converted file while it's being generated. MP4 containers store some of the information at the end of the file, which prevents streaming, so unless you use a different container (ogg, mkv, etc) you'll need to use something like qt-faststart to generate real-time compatible MP4 files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜