Answer the question
In order to leave comments, you need to log in
HTML5 broadcasting?
How to execute the button Stop radio stream under html5 player which has only Pause and Play. After all, after a pause, you start playback and the radio stream starts to sound from the moment at which the pause was made. But for listening to live radio, this is not convenient, you need a stop button or a play button that would start buffering the track again.
Answer the question
In order to leave comments, you need to log in
I did this:
When you click on stop, change src to about:blank.
When you click on the play - change to the url of the radio stream.
And if you change the src of the stream by adding a random parameter there when unpaused? Then, in fact, for the player it will be a new URL and this will cause the stream to be read from the server, and not from what it has already downloaded.
You need to set the current time to the beginning of the track:
function stop(track) {
track.pause();
track.currentTime = 0;
}
You can delete the player by the "stop" button, and by "start" you can create it again, or by "stop" you can simply turn off the sound, and by "start" - turn it on.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question