简体   繁体   English

html5视频播放器不会播放一个小时以上的视频

[英]html5 video player won't play videos longer that an hour

My HTML5 video player won't play a file longer than one hour. 我的HTML5视频播放器不能播放文件超过一小时。 Here is my code: 这是我的代码:

<video src="/Movies/MP4/Blaa.mp4" controls="controls"></video>.  

I am quite new to HTML5 so i am asking what the problem could be? 我是HTML5的新手,所以我想问问题可能是什么? Any answers are appreciated. 任何答案表示赞赏。

-Simon -西蒙

The problem was that chrome won't play MP4 movie files at the moment. 问题是Chrome目前无法播放MP4电影文件。 Safari is the only working browser right now. Safari是目前唯一可用的浏览器。

It looks like you're only using a single mp4 file, so I'm not sure if this will help, but I was able to solve my problem by switching the order of my source files. 看来您只使用了一个mp4文件,所以我不确定这是否会有所帮助,但是我可以通过切换源文件的顺序来解决问题。 From what I can tell, Chrome is able to play H.264 video (which is what is usually contained within the MP4 wrapper), but it is unable to play MP4 files. 据我所知,Chrome可以播放H.264视频(通常包含在MP4包装器中),但无法播放MP4文件。 I'm guessing that they finally removed support for MP4 like they've been saying that they were going to. 我猜想他们终于像说了那样去了对MP4的支持

Here's what my code used to look like: 这是我的代码过去的样子:

<video width="640" height="360" controls>
    <source src="http://example.com/video.mp4" type="video/mp4"  />
    <source src="http://example.com/video.webm" type="video/webm" />
    <source src="http://example.com/video.ogv" type="video/ogg"  />
</video>

From my understanding, when a browser tries to render an HTML5 video tag, it's supposed to skip over any source tags that it can't play, and attempt to play the first one that it can. 据我了解,当浏览器尝试呈现HTML5视频标签时,应该跳过它无法播放的任何源标签,并尝试播放它可以播放的第一个标签。 For whatever reason, Chrome is not currently doing that. 无论出于何种原因,Chrome浏览器目前都没有这样做。 It's trying to play the MP4 anyway, and failing. 它仍然试图播放MP4,但失败了。

Even the video on the " Video for Everyone " page is failing for me now. 现在,即使是“ 所有人的视频 ”页面上的视频对我来说也失败了。

My solution was to switch the order of the source tags so that the webm video came before the mp4 video: 我的解决方案是切换源标签的顺序,以使webm视频先于mp4视频:

<video width="640" height="360" controls>
    <source src="http://example.com/video.webm" type="video/webm" />
    <source src="http://example.com/video.mp4" type="video/mp4"  />
    <source src="http://example.com/video.ogv" type="video/ogg"  />
</video>

So far this has fixed the problem. 到目前为止,这已经解决了问题。 Chrome now plays the webm file with no issues, and all other browsers I have tested still seem to work fine. Chrome现在可以正常播放webm文件,而我测试过的所有其他浏览器似乎仍然可以正常运行。

The only possible problem that I still need to test for is that I've read that the iPad had a bug that required the MP4 source to be listed first. 我仍然需要测试的唯一可能问题是,我已经读到iPad存在一个错误,该错误要求首先列出MP4源。 I'm working on getting my hands on an iPad to see if that's still an issue. 我正在尝试在iPad上操作,以查看是否仍然存在问题。

For now, this solution fixed my problem. 目前,此解决方案解决了我的问题。

Hope that helps! 希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM