I am trying to make an audioplayer using the p5.js Javascript Library and Soundcloud API. Most of it works well, but I am encountering some minor problems in the Safari Browser.
This is the website and the javascript file with all the functions is sketch.js.
There is a progressbar on the website and when clicked it should jump to a point in the song.
var progressBar = document.getElementById('progressBar');
progressBar.addEventListener("click", function(progbar) {
var percent = (progbar.offsetX / this.offsetWidth);
sound.jump(sound.duration() * percent);
sound.onended(endSong);
}, false);
In Firefox it works as expected as long sound.playMode('restart')
is set. But Safari creates an InvalidStateError
When sound.playMode('sustain')
is set both Firefox and Safari equally jump to a point in the song but the song is played twice.
Does anybody have a clue what might be wrong here?