How to play audio using javascript?

Today, We want to share with you play audio javascript.In this post we will show you javascript audio stop, hear for audio html we will give you demo and example for implement.In this post, we will learn about Download Play Mp3 Music with an example.

Playing Music using JavaScript

play sound javascript

var audio = new Audio("hindi/Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3");
audio.play();

play audio in javascripts

var audio = new Audio('Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3');
audio.play();

play audio javascripts

var bMusic = new Audio('Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3')
	bMusic.play()

play a sound wiith js

var audio = new Audio('Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3');
  audio.play();

play sound in javascript



javascript play audio

//play audio with from html audio element: 
document.getElementById('song_name').play();

//play audio with out html audio tag
var myAudio = new Audio('Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3');
myAudio.play();

The following is a sample script that can play a song_name file.



Click the buttons to play or pause the song_name.

I hope you get an idea about javascript play sound onclick.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment