chronister Posted December 4, 2010 Share Posted December 4, 2010 Hello All, I am attempting to create some audio tags via JS. I am using the following code. <script> var audioElement = document.createElement('audio'); audioElement.setAttribute('src', '/lib/audio/01Gen002.ogg'); audioElement.currentTime = 10; audioElement.play(); </script> When I drop out the audioElement.currentTime line it works just fine, but that line produces the following error.... Error: uncaught exception: [Exception... "An attempt was made to use an object that is not, or is no longer, usable" code: "11" nsresult: "0x8053000b (NS_ERROR_DOM_INVALID_STATE_ERR)" location: "http://base/bible/index/25 Line: 75"] I am attempting to play the audio from a specific point and I am not having any luck. Am I using this element wrong? Thanks in advance for the help. Quote Link to comment https://forums.phpfreaks.com/topic/220673-audio-via-html5/ Share on other sites More sharing options...
chronister Posted December 5, 2010 Author Share Posted December 5, 2010 Well I figured it out. For the last 4 or 5 questions I posted on here, I got no response from really anyone. So for anyone who might be helped by my solution, an event has to fire to bring this object back to a state where the currentTime property can be set. Nate Quote Link to comment https://forums.phpfreaks.com/topic/220673-audio-via-html5/#findComment-1143336 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.