Riff / Built on the open web / Media
Screen Wake Lock
Keeps the screen on while a video plays in Now Playing, and only then.

How Riff uses it
One function computes a single condition: a video is playing, Now Playing is open, and the page is visible. When that becomes true it requests a screen lock. When it becomes false it releases it. It runs from the video's play, pause and ended events, the player's open and close events, and visibility changes.
Why
Without it a phone would dim and lock partway through a video.
Without it
The call is guarded by navigator.wakeLock and a try/catch, so the screen follows the system timeout.
Where
- plugins/riff/assets/riff.js, line 1511
wakeLock = await navigator.wakeLock.request( 'screen' );
Links open the source at the commit this page was published from.
Reference: Screen Wake Lock on MDN.