All subjects · Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
Audio, video and inline frames
Edexcel IAL Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
Media elements embed sound and video, with controls and alternative file formats; inline frames embed content from other websites (spec 7.3.5 and 7.3.6).
Audio and video
<video width="480" height="270" controls poster="images/poster.jpg">
<source src="media/tour.mp4" type="video/mp4">
<source src="media/tour.webm" type="video/webm">
Your browser does not support the video element.
</video>
<audio controls>
<source src="media/welcome.mp3" type="audio/mpeg">
<source src="media/welcome.ogg" type="audio/ogg">
Your browser does not support the audio element.
</audio>- Multiple file formats: browsers support different formats, so give several
<source>elements. The browser plays the first one it supports. The type attribute lets it skip unsupported files without downloading them. - The text inside is shown only by browsers that do not support the element.
- A single file can use src on the element itself:
<audio src="welcome.mp3" controls>.
Attributes and controls
| Attribute | Effect |
|---|---|
| controls | Shows the browser's play, pause, volume and timeline controls |
| autoplay | Starts playing as soon as possible (most browsers only allow this if muted) |
| muted | Starts with the sound off |
| loop | Starts again when it ends |
| poster (video) | Image shown before the video plays |
| preload | Hints how much to download in advance: none, metadata or auto |
| width, height (video) | Size of the video area |
controls, autoplay, muted and loop are Boolean attributes
Customising controls
To give media your own buttons, leave out controls and use JavaScript with the media element's methods and properties:
const vid = document.getElementById("tour");
document.getElementById("playBtn").addEventListener("click", function () {
if (vid.paused) {
vid.play();
} else {
vid.pause();
}
});Other properties include currentTime, volume (0 to 1) and muted. For accessibility, captions can be added with a <track> element (kind="captions").
Inline frames (7.3.6)
An <iframe> displays another web page inside the current one: a map, a video from a video-sharing site, a booking widget or a news feed.
<iframe src="https://www.example.com/map" width="600" height="400" title="Map showing the sports centre"></iframe>- src is the page to embed; width and height set the frame size (a frame that is too small gets scroll bars).
- title describes the frame for screen readers.
- The content stays up to date because it comes from the other site, but the page depends on that site being available, and some sites refuse to be framed.
Worked example
A video plays in Chrome but not in another browser, which does not support MP4. How can the page support both browsers?
- Leave out src on the video element.
- Add two source elements, one MP4 and one WebM, each with its type.
- The browser plays the first format it supports.
Answer: Provide the video in several formats with source elements inside the video element.
Check yourself
- Why might a video element contain two source elements?
- To play two videos at the same time
- To show a poster and a video
- To add subtitles in two languages
- To give the same video in two formats, so each browser can play one it supports
Show answer
To give the same video in two formats, so each browser can play one it supports. The browser picks the first source it can play.
- Which Boolean attribute makes the browser show play, pause and volume buttons on an audio element? Type the attribute name.
Show answer
controls. controls displays the browser's built-in media controls.
- A video has sources in this order: WebM, MP4, Ogg. A browser supports MP4 and WebM. Which file does it play?
- The MP4 file
- The Ogg file
- It plays all three in turn
- The WebM file
Show answer
The WebM file. The browser uses the first source it supports, which is the WebM file.
- What does the src attribute of an audio element specify?
Show answer
The location (path or URL) of the audio file to play.. src gives the location of the media file. Pearson's June 2025 report said vague answers did not earn the mark, so name both the location and the file.
- Which element embeds a map from another website inside a page?
- `<embed-page>`
- `<frame-src>`
- `<iframe>`
- `<link>`
Show answer
`<iframe>`. iframe (inline frame) displays another page inside the current one.
- Give one disadvantage of using an iframe to show content from another website.
Show answer
The page depends on the other website: if it is down or changes, the content will not appear.. The content is controlled by another site: it may be unavailable, change, slow the page, track users or refuse to be framed.
- A designer wants a background video to start automatically. Which pair of Boolean attributes do modern browsers require for autoplay to work?
- autoplay and controls
- loop and poster
- autoplay and muted
- preload and controls
Show answer
autoplay and muted. Most browsers block autoplay with sound, so autoplay needs muted.
Sources
- Pearson Edexcel International Advanced Subsidiary/Advanced Level in Information Technology specification (first teaching 2018), Unit 2 Topics 7 to 11
- Pearson qualifications: Edexcel International Advanced Level Information Technology (2018)
- Pearson WIT12/01 examiner report, June 2025 series
Last updated 8 November 2026. Spotted a mistake? Tell us.