+ 2
how can we play song in our html?
10 odpowiedzi
+ 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).
+ 3
You transfer it via USB or cloud to your PC and put it in the same folder with the html file.
+ 2
If the file is one of the 3 files Mp3 ,wav or ogg then you add it to ur script
+ 2
<media>link</media>
+ 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>
+ 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>
+ 1
how to play a song that i have in my phone on html?
+ 1
thanks bro it works 😊😊😊
+ 1
<bgsound src="audio.mp3">
+ 1
press ^ to give up vote if it is helpful.