Error displaying video html

2

I am putting a video using html5 and codeigniter on my page, but it is only displaying 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 content in the folder where the video with the following content is located:

AddType video/mp4 .mp4
    
asked by anonymous 26.03.2014 / 19:07

4 answers

1

As already quoted in the answers, it is most likely that the file extension is not being interpreted by the browser ("Check the file path too"). I believe this will solve 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> 
    
02.04.2014 / 14:30
0

Solution

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

A bar before assets in the video path

    
26.03.2014 / 19:14
0

Away,

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

For example, chrome is sure to display videos with the .ogg format, since Mozzila and IE do not.

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

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

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

    
27.03.2014 / 23:14
0

I do not know, but I ran a test and it worked fine here.

Just to test it yourself, try to access without base_url, try direct

Look at a JSFiddle test

    
31.03.2014 / 15:25