Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can video tag be used in HTML 5 to run mp3 audio file?

Tags:

html

I am using audio tag to play mp3 file in HTML 5 , rather i want to use video tag for HTML 5. Is that possible and how can i do that?

<audio class="audio" id="c_step_1_audio" controls preload="none" style="display: none"> 
     <source src="test.mp3" type="audio/mpeg">
</audio>

I want to do as follows

<video class="audio" id="c_step_1_audio" controls preload="none" style="display: none"> 
   <source src="test.mp3" type="audio/mpeg">
</video>
like image 831
Mayur Avatar asked Sep 30 '22 07:09

Mayur


1 Answers

This is neither recommended nor approved in any browser or W3C. But try it, might work some where if you are lucky.

<video width="320" height="240" controls>
  <source src="test.mp3" type="audio/mpeg">
Your browser does not support audio in video tag.
</video>
like image 60
XIMRX Avatar answered Oct 04 '22 20:10

XIMRX