Keep audio playing across pages
NotebookLM illustrates listening while working elsewhere. Try keeping one audio player alive as the page content changes.
NotebookLM · Mobile · Source post
Keep playback going while reading through materials
An independent web example inspired by the original reference.
Choose an audio file from your device, play it, then select “Next page”.
Implementation steps
- Prepare an audio file for the commentary and place a single audio element that supports play, pause, and seek.
- When switching materials, update only the body without recreating the player. In a real service, pass the URL of the recorded audio to src.
- Verify playback continuation when the device goes to the background on target OSes and browsers on real devices.
Acceptance check
Switching materials doesn't reset playback to the start, and users can pause and resume.
View sample code
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Keep playback going while reading through materials</title>
<style>
* { box-sizing: border-box; }
body {
margin: 0;
padding: 16px;
background: #23232a;
color: #f4f0ea;
font: 16px/1.6 system-ui, sans-serif;
}
label, output, strong, audio, progress { display: block; margin: 6px 0; }
input, select, button { max-width: 100%; font: inherit; }
input, select { padding: 4px 7px; }
button {
margin: 4px 0;
padding: 5px 12px;
cursor: pointer;
border: 1px solid #b5a399;
border-radius: 6px;
}
:focus-visible { outline: 3px solid #ffad73; outline-offset: 2px; }
audio { width: 100%; }
[hidden] { display: none !important; }
</style>
</head>
<body>
<label>Audio file <input type="file" id="track" accept="audio/*"></label>
<audio controls id="player"></audio>
<button id="next">Next page</button>
<output id="page">Page 1</output>
<script>
const player = document.querySelector('#player');
let previousURL;
document.querySelector('#track').onchange = event => {
const file = event.target.files[0];
if (!file) return;
if (previousURL) URL.revokeObjectURL(previousURL);
previousURL = URL.createObjectURL(file);
player.src = previousURL;
};
let page = 1;
document.querySelector('#next').onclick = () => {
page = page === 1 ? 2 : 1;
document.querySelector('#page').textContent = 'Page ' + page;
};
</script>
</body>
</html>Save as index.html and open in a browser to run it locally.