See the complete list of tags for Cambridge IGCSE.
In this tutorial:
The syntax for embedding video is similar; see the Add video in HTML5 tutorial.
Basic syntax
Sound files are embedded in an HTML page using the <audio>
tag combined with one or more <source>
tags.
src
specifies the file to be played
type
specifies the file type to be played
<audio controls> <source src="bleep.ogg" type="audio/mpeg"> </audio>
In the example code, the file bleep.ogg
does not exist; as a result, the controls below show an elapsed time of 00:00 and a total time of 00:00.
Alternative formats
It is possible to include more than one source. If the first source does not play, the next source will be used.
<audio controls> <source src="Othello-Reading-Act-4-Scene-1.ogg" type="audio/ogg"> <source src="Othello-Reading-Act-4-Scene-1.mp3" type="audio/mpeg"> </audio>
Computer Browser says no
If the browser does not support the <audio> tag, a text message can be displayed.
<audio controls> <source src="bleep.ogg" type="audio/ogg"> <source src="bleep.mp3" type="audio/mpeg"> Your browser does not support the audio tag. </audio>
References:
- HTML <audio> Tag (no date) HTML audio tag. Available at: https://www.w3schools.com/tags/tag_audio.asp (Accessed: 7 April 2024).