Riff / Built on the open web / Media
Remote Playback
Shows the cast button only when a Chromecast or AirPlay target is in reach.

How Riff uses it
The script watches availability once, and the callback shows or hides every cast button as a device comes in and out of range. Safari takes the equivalent WebKit path for AirPlay. Pressing the button prompts the browser's device picker on whichever element is live.
Why
There is no other standard way to know a device is near, so the buttons would either always show and do nothing, or never show.
Without it
Both calls are optionally chained, so a browser with neither keeps the buttons hidden.
Where
- plugins/riff/assets/riff.js, line 1403
audio.remote.watchAvailability( castAvailable ).catch( () => {} ); - plugins/riff/assets/riff.js, line 1410
m.remote.prompt().catch( () => {} );
Links open the source at the commit this page was published from.
Reference: Remote Playback on MDN.