vendredi 5 mai 2017

How to make this playist Random?

guys. I have the script above which plays my videos. I've tried using VideoJS and it doesn't work. The script I have below plays all my videos but I can't make it play them RANDOM. Can you guys help me make it work so it plays videos randomly?

<script>
$(document).ready(function(){
    var video = document.getElementById('player');
    var vids = ["videos/COMBATE-A-TUBERCULOSE.mp4",
    "videos/Pilula-01.mp4",
                "http://ift.tt/28MmRaY"];
    var current_vid = 0;
    video.volume = 0.2;
    video.setAttribute("src", vids['0']);
    $('video').on('ended',function(){
        current_vid = +current_vid + 1;
        if(typeof vids[current_vid] == 'undefined'){
            current_vid = 0;
        }
        video.setAttribute("src", vids[current_vid]);
    });
  });




Aucun commentaire:

Enregistrer un commentaire