Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 audio tag stop playing and downloading

How to stop downloading audio file to browser in HTML5 audio tag controls when pause is pressed?

like image 658
torayeff Avatar asked Jan 21 '15 13:01

torayeff


People also ask

How do I stop the audio tag from downloading?

“disable download audio html5” Code Answer's Just add controlsList="nodownload" in your video tag.

How do I stop audio playing in HTML?

The pause() method halts (pauses) the currently playing audio.

What is the correct HTML5 element for playing audio files?

The HTML <audio> element is used to play an audio file on a web page.


1 Answers

This will work:

var audio = $("audio").get(0);
audio.pause(0);
var tmp = audio.src;
audio.src = "";
audio.load();
$("audio").remove();
$("#audio-player").html("<audio controls preload='none'></audio>");
audio = $("audio").get(0);
audio.src = tmp;
audio.addEventListener('pause', current-function);

Here is a link for you to follow : HTML5 Video: Force abort of buffering

like image 110
Victor Juliet Avatar answered Sep 22 '22 10:09

Victor Juliet