What is the use of type attribute in audio or video tag | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the use of type attribute in audio or video tag

Use of type attribute

19th Feb 2020, 6:13 AM
Bai Jilla
Bai Jilla - avatar
1 Answer
+ 1
1. Representing audio in digital form involves a number of steps and processes, with multiple formats available both for the raw audio and the encoded or compressed audio which is actually used on the web. Source : https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Audio_concepts 2. Browsers don't all support the same file types and audio codecs; you can provide multiple sources inside nested <source> elements, and the browser will then use the first one it understands: <audio controls> <source src="myAudio.mp3" type="audio/mpeg"> <source src="myAudio.ogg" type="audio/ogg"> <p>Your browser doesn't support HTML5 audio. Here is a <a href="myAudio.mp4">link to the audio</a> instead.</p> </audio> Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio https://developer.mozilla.org/en-US/docs/Web/Media/Formats
19th Feb 2020, 6:16 AM
Gordon
Gordon - avatar