HTML5 video does not play

I tried a simple example for HTML5, but it doesn't seem to work.

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

I tried the example on chrome, the video loads, but it does not play, I can see the frames of the video if I move the slider back and forth, but the video itself does not play.

UPDATE: I accessed this on localhost (tomcat), it still reacts the same way. I also noticed that I can not play HTML5 video on Chrome or Firefox (updated).

+8
source share
13 answers

Add “controls” as a flag. This allows the browser to run the player’s own code on the video. I tried this with a .mp4 file in Chrome and it works.

+4
source

You cannot upload such a local file using the HTML5 Video tag. You will need to use a local host or a remote file. Try installing mamp / wamp and downloading it through the virtual host.

 <source src="http://localhost/development/programs/html/html5/sample/sample1.m4v" type="video/mp4" /> 
+3
source

I do not agree with Alex Pereora. It can be downloaded from the local computer simply by specifying the file names and / or paths.

I had a similar problem, and it turned out that IIS in Win 7 Pro does not have mp4 mime type in it. Need to add add type mime. see instructions for adding the mime type to the link below.

Html5 video does not reproduce mp4 "Invalid source" error?

+3
source

use both formats, it works fine in all browsers:

 <video width="640" height="360" controls> <!-- MP4 must be first for iPad! --> <source src="unbelievable.mp4" type="video/mp4" /><!-- Safari / iOS video --> <source src="movie.ogg" type="video/ogg" /><!-- Firefox / Opera / Chrome10 --> </video> 
+1
source

The video does not play on the server because the MIME type is not added to IIS.

To add a Mime Type:

• Go to IIS and select your site

• Click "Mime Types" in the menu and click "Add" in the tab on the right.

• In the "File Name Extension" section, add mp4, in the "Mime Type" section, add video / mp4 and click "OK."

• Restart IIS, now launch the application

+1
source

Try setting the relative uri for your video. "D: / ..." only works locally, and not in all browsers.

0
source

Chrome: does the file also contain audio? If so, and you play it on the desktop, connect the speakers to the desktop and check.

Firefox: H.264 Content Not Supported

IE9: To the page <meta http-equiv="X-UA-Compatible" content="IE=edge" />

The following should be added:
0
source

Perhaps this is due to video encoding. Check the encoding of your video and see if Chrome supports this. Perhaps this was a possible reason when I ran into her. Try using some encoders, like ff-mpeg, to encode the video.

0
source

I had this problem when posting to IIS and found a solution here . In my case, even including the full video URL in Chrome would give me a 404 error, because the MIME MP4 type did not exist in the site configuration. So, I added .mp4 with MIME video / mp 4, and everything turned out right. Dunno if this is the same with tomcat, but it's worth a try ...

0
source

add an autoplay loop to the video tag for playback automatically as follows:

 <!DOCTYPE html> <html> <body> <video width="320" height="240" autoplay loop> <source src="resources/sample/sample1.m4v" type="video/mp4" /> </video> </body> </html> 
0
source

Just set the controls as a flag, not as a key = value pair:

 <!DOCTYPE html> <html> <body> <video width="320" height="240" controls> <source src="resources/sample/sample1.m4v" type="video/mp4" /> </video> </body> </html> 
0
source

I am facing the same problem now. I get src video dynamically and asynchronously using ajax.

The problem was that the <video> element was loading before src . If we put the <video> element in the DOM after loading src problem will be fixed.

In the case of Angular, we can use *ngIf to fix the problem. The following is a snippet of code:

 <video autoplay *ngIf="src" class="thumbnail"> <source [src]="src" [type]="type"> </video> 
0
source

If your MP4 video type works on IIS / .NET

Add the web.config file to the root of the web.config application with the following contents

  <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <staticContent> <mimeMap fileExtension=".mp4" mimeType="application/mp4" /> </staticContent> </system.webServer> </configuration> 
0
source

Source: https://habr.com/ru/post/916989/


All Articles