A client just asked for a book-reading website with the following settings:
You will need to make a Single Page Application (SPA). This means you will have one
.html file and use AJAX to load the contents of different pages into that file instead of having multiple
.html files and reloading the browser. If you reload, the Audio WILL stop.
Here's what you need to do:
Learn the HTML5
Audio API. In other words, learn
var audio = new Audio(src),
Learn how to make AJAX calls (a framework can help you make the AJAX calls. Easiest choice is jQuery)
Here's a demo app on Plunker: https://plnkr.co/edit/1Z1bdXXLcLn2h4TfkOQA?p=preview
Press the play button and change pages. Notice how the music continues to play while the pages changes.
Also, your server will need to be configured to send you the contents of the pages via AJAX so you can avoid having separate
.html files for different pages and refreshing.
This is what Soundcloud uses for continuous playback. They use backbone.js, but any decent framework will do.