Audio
The audio
element in HTML allows you to embed audio files on a web page. Its functionality is quite similar to that of the video
element. They also share most of the attributes. The only difference is that of their name and the media they serve.
index.html
9
1
2
3
4
5
6
7
<!DOCTYPE html>
<html>
<head> </head>
<body>
<audio src="https://codefinity-content-media.s3.eu-west-1.amazonaws.com/project+courses+folder/audio.mp3" controls></audio>
</body>
</html>
You can also use the source
element to specify multiple versions of the audio in different formats, and the browser will choose the appropriate version based on the device's capabilities.
index.html
99
1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html>
<html>
<head> </head>
<body>
<audio controls>
<source src="audio.mp3" type="audio/mp3" />
<source src="audio.ogg" type="audio/ogg" />
<source src="audio.wav" type="audio/wav" />
</audio>
</body>
</html>
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 5. Capítulo 7
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo