See the complete list of tags for Cambridge IGCSE.

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:

  1. HTML <audio> Tag (no date) HTML audio tag. Available at: https://www.w3schools.com/tags/tag_audio.asp (Accessed: 7 April 2024).

By MisterFoxOnline

Mister Fox AKA @MisterFoxOnline is an ICT, IT and CAT Teacher who has just finished training as a Young Engineers instructor. He has a passion for technology and loves to find solutions to problems using the skills he has learned in the course of his IT career.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.