New course! Every coder should learn Generative AI!
Try a free lesson+ 28
ะow to make the music play automatically๐ต in the code?
Can you please make a code where the music is played automatically๐ง, and explain it a little please๐ฌ
54 Answers
+ 18
Hey there Amirhon Atahanov,
I made a little example:
https://code.sololearn.com/WUON75MtTsor/?ref=app
The problem is that you can't play music automatically without an event, si you've to click the screen.
If you want to make that the user clicks the screen just use a sweet alert :)
https://code.sololearn.com/W61pGgtsXa18/?ref=app
+ 13
Hey there Amirhon Atahanov,
I made a little example:
https://code.sololearn.com/WUON75MtTsor/?ref=app
The problem is that you can't play music automatically without an event, si you've to click the screen.
If you want to make that the user clicks the screen just use a sweet alert :)
https://code.sololearn.com/W61pGgtsXa18/?ref=app
Thank you very much, can I use these codes?
+ 9
Hi Amirhon Atahanov
You cannot play music without any click event in the code
Because all the browsers are very STRICT about it.
+ 8
Well, then, so that the music is played after clicking on any place by the user
+ 5
Actually
I am doing it by eventListener
I mean
If user clicks on any part of body
Then the music will play
+ 5
Amirhon Atahanov & Jsรงk wlcm and sure, you can use it! :D
๐
+ 4
You can even use HTML5 <audio> tag and write "autoplay loop controls" to make it fully automatic.
+ 4
Check out Major ใท 's reference thats the closest soloution known yet, i personally use it thanks to him.
Edit : looks like im wrong Stuvan has a better soloution I haven't thought of u could probably ask for his/her permission to use it Amirhon Atahanov
+ 4
Referance:-
https://code.sololearn.com/WaIDUL4G2fut/?ref=app
Wow thanks, can I use this code? (I will not copy, for example)
+ 4
it is an open source so you can use it freely
here the link:
https://github.com/goldfire/howler.js/
Thank you so much
+ 4
Amirhon Atahanov & Jsรงk wlcm and sure, you can use it! :D
+ 3
I do not know
Eh, then don't answer
+ 3
Misunderstandings
๐๐๐๐ค
+ 3
With this question I got the badge:
Question Ninja
Post 10 questions with at least 5 upvotes each
+ 3
you need to add a link to music only from Dropbox?
+ 3
<audio autoplay controls src=[link]>
</audio>
The audio will be playing automatically as soon as it loads
Thanks bro โบ๏ธ
+ 3
<audio src="music-mp3" controls autoplay></audio>
Or:
<audio controls autoplay>
<source src="music-mp3" type="audio/mp3"></audio>
Notice that if ur using the 2nd way u have to mention the type attribute, which can be easily recognizable in the link of the music , for exp : mp3,ogg,...
Thanks ๐
+ 3
Watch this video https://youtu.be/C_sJPWHgh3w
๐๐๐ค
+ 2
You can't do it on this platform
+ 2
Misunderstandings