+ 2
Why doesn't background music work?
13 Respostas
+ 2
i can think of a work around, dont know if itll work. go to js inside window onload listener.
create another load listener for <audio> then play()
+ 1
close the audio tag </audio>
+ 1
You can only play an audio file when a user allows it to play,
Which means that you have to add eventListener like "click" to trigger the play() method
Do it like this..
In html
<div id="song"> play song</div>
Do some styling in css..
In js
Var song = document.getElementById("song")
Song.addEventListener("click", function(){
Your_audio_name.play();
});
+ 1
You need to put controls for audio, like this:
<audio controls src="" autoplay>
My advice: don't put autoplay attribute, it's very annoying from the users' point of view.
Cool code, you are doing great!
0
try audio with autoplay
<audio autoplay src="">
i cant load the url, tried it in browser same result. idk maybe its just my internet
0
it don't help
0
check the url, is it really working ? i tried it before its not sending anything
0
url works
0
and now after I entered <audio> my blocks disappeared
0
0
not allowed
https://code.sololearn.com/WDEz2Pv45Rin/?ref=app
0
thanks