Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 video not playing

Tags:

html

I tried a simple example for HTML5 but it doesnt seem to work.

<!DOCTYPE html>
<html>

<body>
  <video width="320" height="240" controls="controls autoplay">
    <source src="resources/sample/sample1.mp4" type="video/mp4" />
  </video>
</body>

</html>

I tried the example on chrome, the video loads up, but it does not play, i can see the video frames if i move the slider to and fro but the video itself doesnot play.

UPDATE: I accessed this on localhost(tomcat), its still reacting in the same way. Also i noticed that i am not able to play any HTML5 videos on chrome or firefox(updated).

like image 383
frewper Avatar asked May 30 '12 09:05

frewper


People also ask

Why is my video not working in HTML5?

If your browser error "HTML5 video file not found", it means that your browser is not up to date or website pages does not have a suitable video codec. It would help if you communicated with the developer to solve the issue and install all the required codecs.

Why video Cannot play in HTML?

The video files are not in the right place on the server, so you're getting 404 or 503 errors on them. The video files are not encoded correctly in a way the browser can play them. This may be the case if the wrong codec was used or if the bit rate is way too high (not super likely).

Can we play video in HTML5?

With the introduction of HTML5, you can now place videos directly into the page itself. This makes it possible to have videos play on pages that are designed for mobile devices, as plugins like Adobe Flash Player don't work on Android or iOS. The HTML <video> element is used to embed video in web documents.


2 Answers

Add "controls" as a flag. It allows the browser to run it's own player code on the video. I tried this with a .mp4 file on Chrome and it works.

like image 182
rasingh Avatar answered Oct 23 '22 08:10

rasingh


I do not agree with Alex Pereora. It can be loaded from local machine just by referencing file names and or paths.

I had similar issue, and turned out IIS in Win 7 Pro does not have mp4 in it's mime types. Must add add the mime type. see instructions for adding mime type in link below.

html5 video is not playing mp4 error "Invalid Source"?

like image 5
bryanp Avatar answered Oct 23 '22 09:10

bryanp