Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

HTML5 audio player - play where it left off?

Is it possible to hack the html5 audio player somehow to continue playing from the part it left off? So when the user returns to the website, it won't start the song all over again from the beginning.
[Image: OOFlLY4.png]
This is a very basic way, could be made a lot better I'm sure, but optimisation is your job. :)

You will need localstorage, or cookies if you wanted, there's plenty of plugins for that. This works by setting the current time to local storage every 3 seconds. Then on page load it checks to see if the record exists, and if it is, then it loads the time and plays the audio element.

http://pastebin.com/k9kZbran - Courtesy of Tasemu
For some reason I couldnt post the code. Had Ayz do it for me. Anyway let me know if you have issues.
It doesn't seem to be working for me, however this saving to localstorage method looks pretty interesting
[Image: OOFlLY4.png]
It's not copy/paste code. You need to find yourself a localstorage plugin for JS and use that to store and retrieve the values.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by MarketplaceDec 19, 2020 01:39 PM 10 159 Dec 19, 2020 01:39 PM
Last Post: Kriptik
by HoneybunMar 29, 2018 11:18 AM 2 122 Mar 29, 2018 11:18 AM
Last Post: Honeybun
by TheUnknown0Dec 17, 2017 02:21 AM 2 122 Dec 17, 2017 02:21 AM
Last Post: Invincible