Chrome will not play .mp4 file

I am trying to get HTML5 video to work. I work on a local server.

<video id="headervideo" controls> <source src="<?php echo base_url(); ?>assets/home.mp4" type="video/mp4"> Your browser does not support the video tag. </video> 

However, the file refuses to play. When I access it with an absolute path, it just shows the player with the play button pressed. What could be the problem here?

+4
source share
2 answers

Browsers such as Internet Explorer and Safari support the .H264 codec, which plays mp4 files. Firefox supports Theora codec, which plays .ogv files. Chrome supports both .H264 and Theora. But for your video to work in all browsers, you need to encode your mp4 video in different formats using an application like HandBrake. Then enter your code:

 <video id="headervideo" controls> <source src="<?php echo base_url(); ?>assets/home.mp4" type="video/mp4"> <source src="<?php echo base_url(); ?>assets/home.webm" type="video/webm"> <source src="<?php echo base_url(); ?>assets/home.ogv" type="video/ogg"> Your browser does not support the video tag. </video> 

and also modify your .htacess file to support video

 AddType video/mp4 mp4 m4v AddType audio/mp4 m4a AddType video/ogg ogv AddType audio/ogg ogg oga AddType video/webm webm 
+2
source

Here is a simple solution that worked for me. My problem was playing MP4 video files on Chrome (I think 29 is a new install in late summer 2013). I found this solution after I got through a bunch of similar threads around the WWW and tried a bunch of things with extensions, etc. This is what worked:

Type chrome: flags in the chrome address bar on this page, find "hardware"

Enable hardware accelerated decoding. Then restart it

This will allow you to play mp4 on chrome - and drop it on chromecast if you are trying to do it.

+1
source

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


All Articles