I will show you how to play audio files using Java Script on Visual Studio Code. Code training for beginners. JavaScript for everyone source code github.com/pes... #javascript #tutorial #trending
Пікірлер: 100
@leonardmbibi8013 Жыл бұрын
👍 for the video. I wish you named the variable, "play" differently so it doesn't confuse beginners with the method, "play" within the function.
@TheWheelchairGuy Жыл бұрын
Noted.
@bilegtsdf5776 Жыл бұрын
You've been my angel ever since I couldn't upload images in HTML, I love you, my man, you're one of the gods on youtube. keeeeeep goooiiing!!!!🥰
@TheWheelchairGuy Жыл бұрын
Thanks for watching. Enjoy playing audio files
@raven.4815 Жыл бұрын
Straight to the point, thanks!
@TheWheelchairGuy Жыл бұрын
Thanks for watching
@AyushGupta-xq8fe2 жыл бұрын
Thank You so much Man! I looked for this everywhere and at last it was your video which finally Helped me. Really Thank You!
@TheWheelchairGuy2 жыл бұрын
Glad I could help! Thanks for watching Ayush
@mateipi2 жыл бұрын
Thanks! Exactly what I was looking for to upgrade my website!
@TheWheelchairGuy2 жыл бұрын
Glad I could help!
@bkgraphicdesign34642 ай бұрын
Thank you for the knowledge shared.
@TheWheelchairGuy2 ай бұрын
Glad it was helpful! Thanks
@arab-blogger Жыл бұрын
thanks man keep it up شكرا اخى لقد استمتعت بمشاهدة فيديوهاتك
@TheWheelchairGuy Жыл бұрын
I am happy انا سعيد thank you شكرا
@very-very-boredАй бұрын
You're the best! Thank you so much!
@TheWheelchairGuyАй бұрын
Glad it helped! Enjoy coding
@waliqadri Жыл бұрын
Love your videos bro
@TheWheelchairGuy Жыл бұрын
Thanks bro
@PaperaAstrale6 ай бұрын
thank you i needed this, also this was clear fast and very easy to understand
@TheWheelchairGuy6 ай бұрын
Glad it helped! I hope you like and subscribe
@BlocksOfGoldGD10 ай бұрын
underrated
@TheWheelchairGuy10 ай бұрын
Thanks for watching
@michaelshollaj6428 Жыл бұрын
Great video, liked and subscribed
@TheWheelchairGuy Жыл бұрын
Big thanks
@oloja__ Жыл бұрын
Nice
@KyleeeYT133 ай бұрын
How do I make an image play an audio when I click it? (pls i need help)
@TheWheelchairGuy3 ай бұрын
You can basically add onclick=“functionName()” attribute to the image for example
@shahzadnoori8678 Жыл бұрын
Thanks for best teach
@TheWheelchairGuy Жыл бұрын
Most welcome
@yevvieart Жыл бұрын
thank you! i needed an option to include a pronunciation of my name in a portfolio and this is a life saver!
@TheWheelchairGuy Жыл бұрын
Glad to hear that
@jaimefernandopelembe43397 ай бұрын
Thank you for the video, you helped me very much.
@TheWheelchairGuy7 ай бұрын
Glad it helped. Thanks for watching
@creo_one6 ай бұрын
I love it man, thanks!
@TheWheelchairGuy6 ай бұрын
Glad to hear it! Thank you for watching. I hope you like and subscribe
@ZacDomamuo Жыл бұрын
absolute legend!!!! Thanks :D
@TheWheelchairGuy Жыл бұрын
Glad it helped!
@bijenderlamba9064 ай бұрын
How we do the same if audio is not in the same folder
@kartikeytiwari538811 ай бұрын
thanks for the video. imo u should have mentioned that you were using constrcutor while explaining
@TheWheelchairGuy11 ай бұрын
You are right. I used the constructor implicitly
@user-dr5lh3rc7t2 ай бұрын
Thank you! But How if the server doesn’t allow to upload .mp3?? Is there any alter solutions for making music player at browser? (sorry for my terrible english)
@TheWheelchairGuy2 ай бұрын
Hi there. I'm not sure if this will work, but you could try uploading the audio file to GitHub and copying the source code. This is just a suggestion, though. Also, I just wanted to say that your English is very good!
@26.muh.zakysyahfadil91 Жыл бұрын
nice tq
@TheWheelchairGuy Жыл бұрын
Thanks for watching
@vigilanteagle1980 Жыл бұрын
thank you, that was very helpful for me
@TheWheelchairGuy Жыл бұрын
Glad to hear that!
@noddygoat11 ай бұрын
very cool, thanks! :D
@TheWheelchairGuy11 ай бұрын
Thanks for watching. Please like and subscribe. The road to 20k
@VolumetrickDST3 ай бұрын
THANKYOU
@TheWheelchairGuy3 ай бұрын
You’reWelcome
@jayparm Жыл бұрын
How do you let it select an audio file randomly to play from a folder? AND How do you make a transition sort of thing (play a file during songs) AKA a radio
@TheWheelchairGuy Жыл бұрын
You can try something like this: const musicFiles = ["music1.mp3", "music2.mp3", "music3.mp3"]; const audio = new Audio(); function playRandomMusic() { const randomIndex = Math.floor(Math.random() * musicFiles.length); audio.src = musicFiles[randomIndex]; audio.play(); }
@israelalcudia921118 күн бұрын
Hello, is it possible to add autoplay with audio in Safari?
@TheWheelchairGuy18 күн бұрын
Autoplay has been disabled on Chrome and Safari for personal security reasons.
@manishabhatt1243 ай бұрын
Tq u
@weareloved10 ай бұрын
Thank you!
@TheWheelchairGuy10 ай бұрын
You're welcome!
@jefferyaaron3462 Жыл бұрын
Thanks bro
@TheWheelchairGuy Жыл бұрын
You’re very welcome bro
@ItachiUchiha-gv5vl Жыл бұрын
thank you my dude
@TheWheelchairGuy Жыл бұрын
Happy to help
@gabbiimartire9299 Жыл бұрын
Gracias. Me salvaste
@TheWheelchairGuy Жыл бұрын
De nada
@mala.m.m Жыл бұрын
Hi there. If I would like the audio to simply play on click/tap how do I replace the button line of code?
@TheWheelchairGuy Жыл бұрын
You basically add the onclick=“functionName()” to any html element. See all touch events here developer.mozilla.org/en-US/docs/Web/API/Touch_events
@mala.m.m Жыл бұрын
@@TheWheelchairGuy Thank you for taking the time to respond! Tis much appreciated
@oneplace-ii1bp2 ай бұрын
this code not working in iphone browser
@TheWheelchairGuy2 ай бұрын
Could you please tell me what iPhone are you using?
@kaushalyalakshitha9682 Жыл бұрын
Thanx
@TheWheelchairGuy Жыл бұрын
Welcome ✌️
@felix-zp4ie9 ай бұрын
thanks!
@TheWheelchairGuy9 ай бұрын
You bet!
@PeriklesPeriklesoglu Жыл бұрын
thanks
@TheWheelchairGuy Жыл бұрын
You are welcome
@uwotgames9 ай бұрын
too confusing i only know html and css and want the text i click to play some audio
@TheWheelchairGuy9 ай бұрын
Sorry for confusion
@aestellatv6524 Жыл бұрын
doesnt work, i tried with image link and mormal image
@TheWheelchairGuy Жыл бұрын
Make sure you attach the function to an element. For instance, onclick="function()"
@Bignaqc Жыл бұрын
The audio isn’t playing
@TheWheelchairGuy Жыл бұрын
Check your code and make sure to place the script before the end of the body tag. You can get my code in the description of this video
@rexzy1852 Жыл бұрын
how if want auto play?
@TheWheelchairGuy Жыл бұрын
You can try something like window.onload = function() { var audio = new Audio('audio_file.mp3'); audio.play(); } However, some browsers do not allow this because of safety concerns
@martapfahl940 Жыл бұрын
Do you know how to make it work on mobile? I have a Timer that counts down and when expired on desktop it will fire the audio but not on mobile....
@TheWheelchairGuy Жыл бұрын
This works on computer, but on your mobile, the browser that you run code with might not support JavaScript Audio
@martapfahl940 Жыл бұрын
@@TheWheelchairGuy Is there a way to make it possible? I have built a pomodoro timer app with React so having no audio when timer is expired would really suck.
@TheWheelchairGuy Жыл бұрын
@@martapfahl940 you can use setInterval to start the function when the timer is done.
@martapfahl940 Жыл бұрын
@@TheWheelchairGuy You mean start the interval when the user clicked the timer? The problem is the user can pause the timer so the sound would fire earlier then... But you confirm there is no other option that user events to trigger sounds on mobile?
@TheWheelchairGuy Жыл бұрын
@@martapfahl940 You can say for instance, whenever variable count down becomes zero, trigger the sound function
@MERV_ Жыл бұрын
I cant get it to work and it's driving me mad
@TheWheelchairGuy Жыл бұрын
You can get the code here. github.com/pescad085/javaScriptAudio/blob/main/Sound.html
@bprodu1 Жыл бұрын
How to play 4 audio files?
@TheWheelchairGuy Жыл бұрын
I should make a tutorial about that
@aceofspades025 ай бұрын
works in computer; works not in mobile.
@TheWheelchairGuy5 ай бұрын
It depends on browsers. Some browsers don’t support JavaScript and autoplay
@masudiqval85757 ай бұрын
🦨 🐰🐇 🕊
@TheWheelchairGuy7 ай бұрын
I don’t know what that means
@JabbaDaHut-v7m5 күн бұрын
Please don't write script code into an html file...
@TheWheelchairGuy5 күн бұрын
It is optional to write the script in the HTML file or not