Reputation: 2261
I'm building a website with a music player, using an <audio>
tag.
I'm using jQuery to make some basic operation like "pause" and "play":
$("#music_player")[0].pause();
$("#music_player")[0].play();
In Chrome everything seems to be fine, but in Firefox it isn't working.
Does somebody know what is the problem? Or what other commands in JavaScript can control the audio tag?
Upvotes: 1
Views: 2931
Reputation: 46
You cannot play mp3 files in Opera and Firefox. Use both .ogg and .mp3 format to play audio in all browsers.
<audio id="music_player">
<source src="sound.mp3"></source>
<source src="sound.ogg"></source>
</audio>
Upvotes: 2
Reputation: 1851
First of all I would suggest to follow this link: http://www.position-absolute.com/articles/introduction-to-the-html5-audio-tag-javascript-manipulation/
It give an example on how to use audio tag in html and manipulate it in javascript. If you see Your browser does not support the audio tag.
instead of an audio widget, thats because your firefox version doesn't support HTML5 audio tag.
Upvotes: 2