vendredi 26 janvier 2018

unable to update currentTime of html5 audio in chrome, Works in firefox and edge

audio files are unseekable in chrome, they don't work altogether in opera. However, I am able to see the audio file using firefox and Microsoft edge. I read on StackOverflow that I have to enable byte range support on the server. How I can do that and why it's working in firefox and edge if byte range is disabled. And I dont get any errors in console. Just that the file starts from the beginning whenever I update the audioElement.currentTime

Here is the code that I am using to seek the audio file

$(".progress2").on("click", function (event) {
    console.log("clicked")
    var offset = $(this).offset();
    var left = (event.pageX - offset.left);
    var totalWidth = $("#custom-seekbar").width();
    var percentage = ( left / totalWidth );
    var vidTime = audioElement.duration * percentage;
    audioElement.currentTime = vidTime;
})

<p id="custom-seekbar" class="progress2"><span></span></p>

I am on a windows server, using xampp and Laravel. Spent a lot of time on this, let me know how I can get this working or if there are any alternatives to this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire