samedi 25 mars 2017

How to start a HTML 5 video from a particular position in laravel 5

i new start a video in a specific position when the web is loading, i get the position using a eloquent var coming from the controler. I also use jquery for other functions in the same view. I have checked the variables arrive correctly so I do not know where is the error.

The strange thing is this method only works if I show a alert popup before in firefox. (not work in chrome or other browser).

This is my code:

    <video id="video" style="display:none; width:100%; height:100%;" autoplay>
              <source src="/files/convert/videos/" type="video/mp4" />
              Su navegador no soporta el tag video.
    </video>

<script>
          var vid = document.getElementById("video");
          var time = ;
          var isPlaying = ;
          var moviesArr = [];
       };      
          var j = jQuery.noConflict();

          j(document).ready(function() {

            if(time >= 0 && isPlaying == 1){
                //vid.currentTime = time;

              }
            });
function setCurTime() { 
              vid.currentTime = time;
            };
</script> 

Also i trying use:

document.getElementById('video').addEventListener('loadedmetadata', function() {
          this.currentTime = time;
        }, false);

But the problem is not solved.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2no73W2
via IFTTT

Aucun commentaire:

Enregistrer un commentaire