Reputation: 2569
I'm having a problem using currentTime in audio html5. It gives me an error in console
InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable
And a warning:
HTTP "Content-Type" of "audio/mpeg" is not supported. Load of media resource http://s3.amazonaws.com/audiojs/02-juicy-r.mp3 failed.
But when I get rid of this line of codes I don't get any console error and warning.
$(".play").click(function(){ var mediaElement = document.getElementById('mediaElementID'); mediaElement.currentTime = 29; });
And I'm currently using the audio.js. I've run through different modification in my code but still its not working. Here is my javascript code:
audiojs.events.ready(function() { audiojs.createAll(); $(".play").click(function(){ var myAudio = document.getElementById('myAudio'); myAudio.currentTime = 29; }); });
Upvotes: 3
Views: 1805
Reputation: 1838
For Firefox convert your mp3 to ogg and use ogg. For Chrome mp3 works fine but it also works with ogg so if you convert to ogg you don't have to worry which browser needs what.
Upvotes: 0
Reputation: 3461
I get this error when the load of mp3 file is failed. For example it fails in Firefox because it doesn't support mp3. And it seems to work in Chrome. Try to put different file formats for different browsers.
Upvotes: 0