Advertisements
Advertisements
Question
In a webpage, an audio file is embedded using element as per following code. But when HTML page is opened in Chrome browser, nothing is shown. What could be the possible reason?
<audio src="beyonce.mp3" >
Your browser does not support
AUDIO element.
</audio>
Code Writing
Short Answer
Advertisements
Solution
Because there was no method to play the music due to the missing controls attribute, the audio file was invisible. To enable the user to hit “play”, we need to provide the audio file with some controls.
Therefore, the corrected code is:
<audio src="beyonce.mp3" controls="controls">
Your browser does not support AUDIO element.
</audio>shaalaa.com
Is there an error in this question or solution?
