Computer Applications

Gulzar is a talented musician. He is trying to create a web page so as to share his creations with music lovers across the world. He wants to embed audio and video files in the web page with the following specifications :

To embed audio files :

(i) The name of audio file is GulzarNote1.mp3

(ii) The audio should start playing automatically when the page loads.

(iii) The audio controls such as Play, Pause and Volume should be visible.

To embed video files :

(i) The name of video file is GulzarMovie1.mp4

(ii) The video should play in a window of width 350 pixels and height 250 pixels.

(iii) The video controls such as Play, Pause and Volume should be visible.

To complete the task, Gulzar has written the following HTML code :

To embed audio :

<audio controls autoplay>
  <source src = "GulzarNote1.mp3">
</audio controls>

To embed video :

<video width = "350" height = "250">
  <source src = "GulzarMovie1.mp4">
</video>

Gulzar is not getting the desired output as the code contains errors. Rewrite the correct statements to help him to complete the task. Underline all the corrections made.

HTML Advanced Features

7 Likes

Answer

Gulzar's HTML code for embedding audio and video has a few errors. The correct HTML code is as follows:

To embed audio :

<audio controls autoplay>
  <source src = "GulzarNote1.mp3">
</audio>
Explanation

controls attribute should be written only in the opening audio tag and not in the closing audio tag.

To embed video :

<video width = "350" height = "250" controls>
  <source src = "GulzarMovie1.mp4" type="video/mp4">
</video>
Explanation

Controls attribute has been added to the opening video tag and the type attribute has been added to source tag.

Answered By

4 Likes


Related Questions