A teleprompter looks like a trivial app: display text, scroll it slowly. Then you build one and discover that the scrolling is a rendering problem, the screen turning off is a platform problem, and the person reading needs controls they can hit without looking.
This is what actually matters when you build one in the browser, using the same pieces as my teleprompter studio (https://ashraf-alrashidi.github.io/teleprompter/).
Do not scroll with setInterval
The obvious approach is setInterval(() => window.scrollBy(0, 1), 30). It stutters. The browser fires timers when it feels like it, and scroll writes on a timer fight the compositor. The result is uneven movement, which is exactly the thing that makes a reader lose their place.
Use requestAnimationFrame and drive position from elapsed time instead of a fixed step:
let last = performance.now(); let y = 0; let speed = 40; // pixels per second function tick(now) { const dt = (now - last) / 1000; last = now; y += speed * dt; el.scrollTop = y; requestAnimationFrame(tick); } requestAnimationFrame(tick); Because the step is speed * dt, a dropped frame does not lose distance: the next frame covers more ground. The motion stays consistent even when the machine is busy.
Keep the transform path open
scrollTop on the container is fine for text, but if you animate with transform: translateY(), the browser can move the layer on the GPU without layout. For long scripts, prefer a single translated wrapper over changing layout properties.
Stop the screen from sleeping
A teleprompter is useless if the phone dims after thirty seconds. The Screen Wake Lock API handles this:
let lock = null; async function keepAwake() { if (!('wakeLock' in navigator)) return; try { lock = await navigator.wakeLock.request('screen'); } catch (e) { // usually a permissions or low-battery policy; fail quietly } } document.addEventListener('visibilitychange', async () => { if (document.visibilityState === 'visible' && !lock) await keepAwake(); }); Two details that matter: the lock is released automatically when the tab is hidden, so you must re-request it on visibilitychange; and it requires a secure context, so it will not work over plain HTTP.
Mirror mode is one line, and it is not a gimmick
Physical teleprompter glass reflects the screen, so the text has to be flipped horizontally. That is transform: scaleX(-1) on the text container. Do it on the container, not the body, or your controls flip too.
Controls people can hit without looking
Speed, pause, font size, and mirror toggle. Put them in a fixed bar with large targets, and bind space to pause. During a talk, the person operating the prompter is looking at an audience, not at a cursor. If a control needs precision, it will not get used.
Font size and line length
Large type with generous line height and a narrow measure reads better than filling the width. A reader needs to see the next line without hunting. Two or three words per line at presentation distance is not too few.
Test with real text
Load a full five-minute script, not a paragraph. Problems that never appear with placeholder text, like scroll drift or a paragraph that jumps when it wraps, show up immediately at real length.
The whole app is a few hundred lines with no dependencies. If you want to see it running, it is here: https://ashraf-alrashidi.github.io/teleprompter/
This article was written with AI assistance and reviewed by Ashraf Alrashidi.