I'm thinking if there is any solution for my case. I have a radio script and I would like to play the selected music even if the page is reloading and after page reload without stopping... I've searched for other threads similar to my case but haven't found exactly about my case. Many of you were talking about using local storage, cookies, sessions, e.g. Is it possible to do that?
Asked
Active
Viewed 92 times
1
-
1The first thing I thought of was SoundCloud. Perhaps this is of use: [How do soundcloud keep music playing on when navigating?](https://stackoverflow.com/questions/18479191/how-do-soundcloud-keep-music-playing-on-when-navigating) Using the HTML5 History API, you can change the address in the address bar, and navigate elsewhere using some JavaScript. Using this method, the music will not stop. If you're doing an actual page refresh/reload, then no, unfortunately you cannot "seamlessly" continue. You could store the time that the music was at and then start playing it at that time on reload. – Tyler Roper Jul 20 '17 at 21:06
-
2Using local storage, cookies or a session will work but you will have a moment of pause in the audio as the page reload will mean the audio and page will load again so the pause will last as long as it takes for the data to reload. The reason people will suggest using those methods is because you can use those to keep track of the current track and time state to enable the page to continue from the last point of play. **So it's more of a resume play than a continuous play.** – NewToJS Jul 20 '17 at 21:07
-
Lukas, if you want the audio to play with no pause but enable page navigation then maybe building a single page website is something that could be useful/beneficial for you. You can find many tutorials and examples online on how to build a single page website. – NewToJS Jul 20 '17 at 21:15
1 Answers
2
If you want a continuous stream of sound when you refresh, then no. Even a page like SoundCloud is not able to do that when you refresh. It is however possible to browse within your site with continuous playing, like SC does.
It is possible to resume from where you left off using methods like sessions and cookies.

lloyd
- 1,089
- 1
- 17
- 39
-
Thank you for your detailed answer. If a such a big website like SoundCloud can't do that, maybe it'll be available in the future. So far as I know, the best option is to do like SC currently does. – Lukas Naujokaitis Jul 20 '17 at 21:12