+ 2

how can we play song in our html?

10th Aug 2016, 9:51 AM
Mahdi
Mahdi - avatar
10 Respostas
+ 7
To play an audio file in HTML, use the <audio> element: Example: <audio controls>   <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> </audio> The controls attribute adds audio controls, like play, pause, and volume. Multiple <source> elements can link to different audio files. The browser will use the first recognized format. The <type> element must be included in <audio>. If the file searched is mp3 the type tag will be type="audio/mpeg". If the file searched is ogg the type tag will be type=" audio/ogg. Currently, there are 3 supported file formats for the <audio> element: MP3, Wav, and Ogg: Browser MP3 Wav Ogg InternetExplorer. YES NO NO Chrome YES YES YES Firefox YES YES YES Safari YES YES NO Opera YES YES YES HTML5 Audio tags: <audio> - Defines sound content <source> - Defines multiple media resources for media elements, such as <video> and <audio> - Dumitru If this answer has helped you, give it a upvote by pressing the button that looks like an thumbs up (like).
10th Aug 2016, 11:28 AM
Dumitru Comarnitchi
Dumitru Comarnitchi - avatar
+ 3
You transfer it via USB or cloud to your PC and put it in the same folder with the html file.
10th Aug 2016, 11:55 AM
Dumitru Comarnitchi
Dumitru Comarnitchi - avatar
+ 2
If the file is one of the 3 files Mp3 ,wav or ogg then you add it to ur script
10th Aug 2016, 10:19 AM
Olamide Laja
Olamide Laja - avatar
+ 2
<media>link</media>
10th Aug 2016, 11:31 PM
Melnraksts (Melnraksts)
Melnraksts (Melnraksts) - avatar
+ 2
put your html file and one of your mp3 file in same folder and then put this code in body tag: <audio controls> <source src="put your mp3 file name" type="audio/mpeg"> <source src="audio.ogg" type="audio/ogg"> Audio element not supported by your browser </audio>
11th Aug 2016, 4:59 AM
diwakar Kumar
diwakar Kumar - avatar
+ 2
<audio controls>   <source src="horse.mp4" type="audio/mpeg"> <source src="horse.mp3" type="audio/mpeg"> </audio> or <audio src="full path of the audio in.mp3 or other" controls> text </audio>
15th Aug 2016, 2:07 PM
Atanu Samadder
Atanu Samadder - avatar
+ 1
how to play a song that i have in my phone on html?
10th Aug 2016, 11:54 AM
Mahdi
Mahdi - avatar
+ 1
thanks bro it works 😊😊😊
10th Aug 2016, 12:00 PM
Mahdi
Mahdi - avatar
+ 1
<bgsound src="audio.mp3">
17th Jun 2017, 1:50 PM
Vishwajeet
Vishwajeet - avatar
+ 1
press ^ to give up vote if it is helpful.
14th Mar 2018, 11:00 AM
Vishwajeet
Vishwajeet - avatar