Answer the question
In order to leave comments, you need to log in
Why is the broadcast stream interrupted in audio?
Hello everyone dear community.
I am not engaged in the most common task - they asked me to tie the streams of radio stations to the radio. I haven't worked with the audio tag before and it disappoints me. It seems to me that there is something enabled by default in it that creates a bug.
In general, I dug up links to the broadcasts of various stations, wrote a script to turn on and off the player for these streams. as a result, a simple script came out
var player = document.getElementById('audio');
var isPlaying = false;
function togglePlay() {
if (isPlaying) {
player.pause();
player.currentTime = 0;//added
player.src = '';//added
isPlaying = false;
console.log(isPlaying);
} else {
player.src = stations.maximum;//added
player.load();//added
player.play();
isPlaying = true;
console.log(isPlaying);
}
}
switchBtn.click(function(){
togglePlay();
});
Answer the question
In order to leave comments, you need to log in
Everything worked in firefox, the problem was only in chrome. While browsing through stackoverflow, I came across a solution. buzz.jaysalvat.com I
actually wrote down the script on the docks and everything plows correctly and without jambs
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question