+ 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💬
53 odpowiedzi
+ 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
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
+ 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).