Error while displaying video html

Asked

Viewed 1,039 times

2

I’m putting a video using Html5 and codeigniter on my page, but is only showing the player without displaying the video.

script:

<video width="420" height="340" autoplay controls>
  <source src="<?php echo base_url('assets/videos/teste.mp4'); ?>" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
  <p>Desculpe o transtorno, mas seu navegador não pode exibir o vídeo.</p>    
</video>    

I also created a . htaccess with the following contents in the folder where the video is with the following contents:

AddType video/mp4 .mp4

4 answers

1


As already mentioned in the replies, the file extension is most likely not being interpreted by the browser ("Check the file path as well"). I believe that solves your problem.

<video width="420" height="340" autoplay controls>
     <source src="video.ogv" type="video/ogg">
     <source src="video.mp4" type="video/mp4">
     <source src="video.webm" type="video/webm">
     <!--(X)HTML Caso queira uma solução em flash -->
     <p>Navegador não suporta o elemento video da HTML5.<br>Faça <a href="video.mp4">download do video</a></p>

</video> 

0

I don’t know, but I did a test and it worked normal here.

Just for testing, try to access without base_url, try direct

Look at a Jsfiddle test

0

Away,

may be the type of video you are trying to run with the browser you do not recognize.

For example Chrome gives the certainty that it will display videos with the format .ogg, already the Mozzila and the IE nay.

A very common fomate that some browsers accept, depending on the version of it, is the format .mp4, as you yourself used.

You can try putting a type of extension for each browser and check if it works, also remove the type and the codecs.

As I said earlier, depending on the browser version you may not recognize the format .mp4.

0

Solution

<source src="<?php echo base_url('/assets/videos/teste.mp4'); ?>" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />

a bar before the Assets in the video path

  • Reply above @Away

  • Not solved... the problem persists.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.