I'm just created html program to play an Mp3 file using javascript. Its working fine if the program runs from a google chrome, but it wont works with firefox(version24, OS:ubuntu). And it outputs some error in console like "HTTP "Content-Type" of "audio/mpeg" is not supported. Load of media resource http://localhost/phpsound/sound_file.mp3 failed"
. Do I need to install any plugin for firefox to solve this issue. Please help me to solve this issue.
Html code:
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="audio/mpeg">
<script language="JavaScript" type="text/javascript">
function play_sound()
{
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', 'sound_file.mp3');
audioElement.setAttribute('autoplay', 'autoplay');
audioElement.load();
audioElement.play();
}
</script>
<body>
<input type="button" name="btnOk" id="btnOk" value=" OK " onClick="play_sound();"/>
</body>
</html>