mjpeg HTML5视频无法使用< video>流式传输 [英] mjpeg HTML5 video doesn't stream with <video>

查看:736
本文介绍了mjpeg HTML5视频无法使用< video>流式传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在HTML 5中显示mjpeg直播视频

I'm trying to display mjpeg live stream in HTML 5

使用< img> 标记 - >没问题,它显示了流很棒,但是,我需要触发一些事件来指示流正确显示的时间

With <img> tag -> no problem it shows the stream great, but, I need some events to be fired to indicate when the stream is properly displayed

例如:

<img src="url" />

使用< video> 标签 - >我能够获得这些活动,但我无法播放mjpeg流

With <video> tag -> I'm able to get those events, but I'm not able to play mjpeg stream

例如:

<video autoplay="autoplay" controls onerror="onError()">
    <source src=url>
</video>

我该怎么办?

推荐答案

对任何MJPEG流都有没有一般支持超出 img 元素的浏览器。 MJPEG 没有官方标准,并且存在许多变化,这些变化可能会对视频元素造成问题如何在不支持每个/大多数变化的情况下检测什么是错误。

There is no general support for MJPEG streams in any browser beyond the img element. MJPEG has no official standard and there exist many variations which could be problematic with the video element as to how to detect what is an error without supporting every/most variations.

对于图像元素,我想已经做出妥协以允许格式化更宽容无法正确分析流的成本。

For the image element I guess a compromise has been made to allow for more tolerance format-wise at the cost of not being able to analyze the stream properly.

我们用 img 监控事件的距离最近element是监听 onload onerror onabort 事件。除此之外,我们没有选择。

The closest we get to monitor events with the img element is to listen to the onload, onerror and onabort events. Beyond that we are given no option.

您可以查看转码解决方案,例如免费的 VLC 结合 MediaTomb (允许管道VLC输出),可以将MJPEG格式转换为另一个格式苍蝇作为一种可能的解决方法。另一种方法是考虑基于Flash的解决方案。

You could look into transcoding solutions such as the free VLC combined with MediaTomb (allow piping VLC output) that can convert the MJPEG format to a different one on the fly as a possible workaround. An alternative to that is to consider a Flash based solution.

这篇关于mjpeg HTML5视频无法使用&lt; video&gt;流式传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆