+ 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💬

25th Mar 2021, 3:36 PM
Amirhon Atahanov
Amirhon Atahanov - avatar
55 Respuestas
+ 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
25th Mar 2021, 3:49 PM
Matthew
Matthew - avatar
+ 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?
25th Mar 2021, 4:14 PM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 9
Hi Amirhon Atahanov You cannot play music without any click event in the code Because all the browsers are very STRICT about it.
26th Mar 2021, 1:43 AM
Monu Sharma
Monu Sharma - avatar
+ 8
Well, then, so that the music is played after clicking on any place by the user
25th Mar 2021, 4:12 PM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 5
Actually I am doing it by eventListener I mean If user clicks on any part of body Then the music will play
25th Mar 2021, 3:39 PM
The INDIAN
The INDIAN - avatar
+ 5
Amirhon Atahanov & Jsçk wlcm and sure, you can use it! :D 😉
25th Mar 2021, 5:14 PM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 4
You can even use HTML5 <audio> tag and write "autoplay loop controls" to make it fully automatic.
25th Mar 2021, 3:59 PM
Nishit Katole 33 VII C
Nishit Katole 33 VII C - avatar
+ 4
Referance:- https://code.sololearn.com/WaIDUL4G2fut/?ref=app Wow thanks, can I use this code? (I will not copy, for example)
25th Mar 2021, 4:26 PM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 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
25th Mar 2021, 4:29 PM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 4
Amirhon Atahanov & Jsçk wlcm and sure, you can use it! :D
25th Mar 2021, 5:13 PM
Matthew
Matthew - avatar
+ 3
I do not know Eh, then don't answer
25th Mar 2021, 4:26 PM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 3
Misunderstandings 🙄😕😑😤
25th Mar 2021, 4:26 PM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 3
With this question I got the badge: Question Ninja Post 10 questions with at least 5 upvotes each
25th Mar 2021, 4:30 PM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 3
you need to add a link to music only from Dropbox?
27th Mar 2021, 4:39 AM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 3
<audio autoplay controls src=[link]> </audio> The audio will be playing automatically as soon as it loads Thanks bro ☺️
27th Mar 2021, 4:44 AM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 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 😊
27th Mar 2021, 10:31 AM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 3
Watch this video https://youtu.be/C_sJPWHgh3w 🙄😔🤐
3rd Apr 2021, 6:46 AM
Amirhon Atahanov
Amirhon Atahanov - avatar
+ 2
You can't do it on this platform
25th Mar 2021, 3:47 PM
VSR [ DEV ]
VSR [ DEV ] - avatar
+ 2
Misunderstandings
25th Mar 2021, 4:23 PM
Programmer.web
Programmer.web - avatar
+ 2
Here's a template for HTML5 music player. https://code.sololearn.com/WWV5CnohkcCy/?ref=app To enable autoplay just put the attribute inside <audio> tag. You can also include attributes like loop (to loop the music indefinitely) and controls (this one is important as it allows the uses to control the player).
25th Mar 2021, 8:43 PM
Abir Hasan
Abir Hasan - avatar