Y in the 2nd way for audio there are two source tags i mean they have written two links... Y?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Y in the 2nd way for audio there are two source tags i mean they have written two links... Y??

5th Apr 2017, 4:00 PM
Shreya Parmar
Shreya Parmar - avatar
7 Answers
+ 1
When the browser finds the audio [EDIT: same for video] tag, it first tries with the first source. If the browser cannot play it, then tries with the second one... and so on.
5th Apr 2017, 4:14 PM
Álvaro
+ 1
and the same thing goes for video element too
5th Apr 2017, 4:22 PM
Shreya Parmar
Shreya Parmar - avatar
+ 1
https://www.w3schools.com/html/html5_audio.asp "The <source> element allows you to specify alternative audio files which the browser may choose from. The browser will use the first recognized format. The text between the <audio> and </audio> tags will only be displayed in browsers that do not support the <audio> element."
5th Apr 2017, 4:23 PM
Álvaro
0
<audio controls> <source src="http://www.sololearn.com/uploads/audio.mp3" type="audio/mpeg"> <source src="http://www.sololearn.com/uploads/audio.ogg" type="audio/ogg"> Audio element not supported by your browser. </audio> so here the source src (2nd one) .ogg is for what?? because the first one already is the audio link and type but is the second one studio quality? because one of ma friend's told me its audio quality
5th Apr 2017, 4:19 PM
Shreya Parmar
Shreya Parmar - avatar
0
for not supported browser
1st Jan 2020, 11:29 AM
Imanuel Wicaksono
Imanuel Wicaksono - avatar
0
for not supported browsers
22nd Mar 2020, 1:12 PM
Anil Kumar Reddy
Anil Kumar Reddy - avatar
0
for not supported browser
4th Jun 2020, 9:43 PM
Kareem Adel Awwad
Kareem Adel Awwad - avatar