Audio auto play? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Audio auto play?

How to add Audio with auto play mood ? Please send me with a code .

13th Aug 2022, 11:33 AM
Abinash Saikia
Abinash Saikia - avatar
16 Answers
+ 6
autoplay is deprecated in modern browsers. It need a gesture or event to autoplay so you need a javascript support.. try to see these possibilities works or not: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide Hope it helps.. edit: try these : <audio loop autoplay controls> <source src="https://dl.dropbox.com/s/nbt7tqcacl3nob8/IPL%20theme%20RMX?dl=0"> </audio> <iframe src="https://dl.dropbox.com/s/nbt7tqcacl3nob8/IPL%20theme%20RMX?dl=0" type="audio/mp3" allow="autoplay"> Audio element not supported by your browser. </iframe> edit: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play#Usage_notes
13th Aug 2022, 12:36 PM
Jayakrishna 🇮🇳
+ 2
Only with html
13th Aug 2022, 11:47 AM
Abinash Saikia
Abinash Saikia - avatar
+ 2
ρү૨œdԌ૨ × I've tested the example you provided. It does not work in this code playground. I also tested it in chrome it does not work. However there is a media autoplay in Chrome and If I set that to allow. It will work with out user interaction. With further testing I have found that it does work in some other code playgrounds. I suspect that those do not follow chromes Browser Policies. And that leads us to the problem with things that are depreciated. Sometimes it works sometimes it don't. https://code.sololearn.com/WmUMGC0InPuD/?ref=app
14th Aug 2022, 1:47 AM
Chris Coder
Chris Coder - avatar
+ 2
ρү૨œdԌ૨ × as already told by others, it won't work here.. That's just a example, but not a working example as per OP expectations.. (On reply only with html), I also given possibilities, which are all ways to do previously, so can go on to check now, if those are working or not in their using browers.. But surely it won't work modern browsers. Details about why, @Mirielle explained in detailed... @Chris provided test example.tqs
14th Aug 2022, 1:36 PM
Jayakrishna 🇮🇳
+ 1
👍Am also mean the the same pointing.. May be indirect.. 🙂
13th Aug 2022, 5:45 PM
Jayakrishna 🇮🇳
13th Aug 2022, 12:35 PM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar
0
@ρү૨œdԌ૨ × So why don't you add an example how to write that, working example of autoplaying pls?
13th Aug 2022, 1:02 PM
Jayakrishna 🇮🇳
0
Correct me if I'm wrong, but... Use `autoplay` on a `<video>` or `<audio>` tag for it to autoplay as soon as it's seen on the screen.
14th Aug 2022, 2:03 AM
Chi Zu
Chi Zu - avatar
0
<!-- Credit - https://dribbble.com/shots/14605167/attachments/6297430?mode=media --> <!-- <a href="https://www.freepik.com/vectors/creative-illustration">Creative illustration vector created by pikisuperstar - www.freepik.com</a> <a href="https://www.flaticon.com/free-icons/google" title="google icons">Google icons created by Freepik - Flaticon</a> <a href="https://www.flaticon.com/free-icons/facebook" title="facebook icons">Facebook icons created by Freepik - Flaticon</a> --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Awesome Login Screen</title> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;500;600;700;800&display=swap" rel="stylesheet"> <script
14th Aug 2022, 5:54 PM
Mehrobiddin Avvalov
Mehrobiddin Avvalov - avatar
0
By using audio starting tag use: <audio autoplay> </audio>
15th Aug 2022, 5:14 AM
Ahmad Zubair Afghanmal
Ahmad Zubair Afghanmal - avatar
0
Hello
15th Aug 2022, 7:49 AM
Arthur Tene
- 1
Not true. Quit peddling jabbascript. Deprecated or not it still works.
13th Aug 2022, 12:37 PM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar
- 1
Jayakrishna🇮🇳 I already gave an example. Unless they deprecated the function in the last 2 years it works. There's also other deprecated things in HTML like <table> that still work.
13th Aug 2022, 11:24 PM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar
- 2
Loop
14th Aug 2022, 10:59 AM
Muzeyi Nicholas