Skip to main content
Inspiring
November 28, 2018
Question

Code works in chrome but not in Microsoft Edge

  • November 28, 2018
  • 1 reply
  • 791 views

I have some questions about this code in javascript.

window.onload = init;

function init(){

var audio = new Audio(),

    i = 0;

var playlist = new Array('mp3.mp3', 'mp4.mp3');

audio.addEventListener('ended', function () {

    i = ++i < playlist.length ? i : 0;

    console.log(i)

    audio.src = playlist;

    audio.play();

}, true);

audio.volume = 0.3;

audio.loop = false;

audio.src = playlist[0];

audio.play();

}

It is running around now and I want it to stay after two mp3 songs. How do I do that? The second that I want to fade in when it starts. This code doesn't work in Chrome but works in the Microsoft Edge browser. What could it be?

    This topic has been closed for replies.

    1 reply

    Preran
    Legend
    November 29, 2018

    Just to be sure, have you tested on other browsers such as Firefox and Safari? Can you let us know your observations?

    peorAuthor
    Inspiring
    November 30, 2018

    No I haven't Firefox or Safari and so no observations. Can you help to solve how I can stop loop efter two mp3 songs. Now so loop running around. Can help me solve this for me with modify the code.

    Preran
    Legend
    December 3, 2018

    I am not sure. Am asking around for assistance. Stay tuned.