简体   繁体   中英

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

My HTML5 video player won't play a file longer than one hour. 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? Any answers are appreciated.

-Simon

The problem was that chrome won't play MP4 movie files at the moment. Safari is the only working browser right now.

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. 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. I'm guessing that they finally removed support for MP4 like they've been saying that they were going to.

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. For whatever reason, Chrome is not currently doing that. It's trying to play the MP4 anyway, and failing.

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:

<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.

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. I'm working on getting my hands on an iPad to see if that's still an issue.

For now, this solution fixed my problem.

Hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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