• 04-12-2019, 19:50:45
    #1
    Merhaba, şöyle bir kodum var ;

    var lastSong = null;
    var selection = null;
    var playlist = ["http://demo.kitapoda.com/bg.mp3", "http://upload.wikimedia.org/wikipedia/commons/a/a9/Tromboon-sample.ogg", "http://static1.grsites.com/archive/sounds/background/background007.mp3", "http://static1.grsites.com/archive/sounds/background/background006.mp3", "http://static1.grsites.com/archive/sounds/background/background005.mp3"]; // List of Songs
    var player = document.getElementById("audioplayer"); // Get Audio Element
    player.autoplay=true;
    player.addEventListener("ended", selectRandom); // Run function when song ends
    
    function selectRandom(){
    while(selection == lastSong){ // Repeat until different song is selected
    selection = Math.floor(Math.random() * playlist.length);
    }
    lastSong = selection; // Remember last song
    player.src = playlist[selection]; // Tell HTML the location of the new Song
    
    }
    
    selectRandom(); // Select initial song
    player.play(); // Start Song
    <button class="btn btn-primary" onclick="play()"><i class="fa fa-play"></i> </button>
    <button class="btn btn-primary" onclick="pause()"><i class="fa fa-pause"></i> </button>

    bu butonlara basıldığında nasıl aksiyon yaptırabilirim?