+ 1
Why do we need to use terms like"src" and "audio.ogg" in audio element?
<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>
4 odpowiedzi
+ 3
src is used to put your source, the audio name for example, or a link, ogg is just a type of audio, like mp3 for example, you don't need to use it, but you can just in case a browser doesn't support mp3 for some reason and supports ogg.
+ 3
There are two ways to put audio.
The first is used if you only want to put one type of audio, like this:
<audio src="music.mp3" type="music/mpeg" controls>
The second way is used to put multiple types of audio, the browser will play the first supported audio it reads:
<audio controls>
<source src="music.mp3" type="audio/mpeg">
<source src="music.ogg" type="audio/ogg">
</audio>
You can add more audio types, ogg and mp3 are just two examples.
+ 1
We do that to specify the source of the audio file to play.
0
Jyothsna Sri
src attribute is for the source(location - much like address) of the file, so that the page can load the file.
And type is to let the computer know what the file type is or which file format so to unpack(or read ) the file in a correct manner.