AirPlay ******* AirPlay support for PRESTOplay for Web Apps. Streams HLS from Apple devices to AirPlay receivers via "AirPlayPlugin" (https://players.castlabs.com/web/latest/docs/api/clpp.airplay.AirPlayPlugin.md). Code samples: * AirPlay (https://raw.githubusercontent.com/castlabs/prestoplay-web-code-samples/refs/heads/main/examples/cast/airplay.js): an AirPlay button, availability and casting status, and the native HLS player on Safari. See "AirPlayPlugin" (https://players.castlabs.com/web/latest/docs/api/clpp.airplay.AirPlayPlugin.md) for the full API. Using the AirPlay plugin ======================== This section shows how to integrate AirPlay with a custom UI. Import the PRESTOplay AirPlay plugin: import "@castlabs/prestoplay/cl.airplay"; Add an AirPlay button to your page: Show the button when AirPlay is available: const button = document.getElementById("airplay"); player.on(clpp.events.AIRPLAY_STATUS_CHANGED, (event) => { if (event.canCast) { button.style.display = "block"; } else { button.style.display = "none"; } }); Open the AirPlay target picker when the button is clicked: button.addEventListener('click', function () { const plugin = player.getPlugin(clpp.airplay.AirPlayPlugin.Id); plugin.showCastMenu(); }); Listen for these events to detect the start and end of an AirPlay session: player.on(clpp.events.AIRPLAY_CASTING_STARTED, () => { // AirPlay casting session started }); player.on(clpp.events.AIRPLAY_CASTING_ENDED, () => { // AirPlay casting session ended }); AirPlay with DRMtoday and upfront authorization =============================================== If your streams are protected with DRMtoday using upfront authorization tokens, each playback session requires a new token. Casting to a device over AirPlay counts as a new session. Use "setDrmCustomDataModifier" to generate a new token for each DRM license request (each playback session): player.setDrmCustomDataModifier(async customData => { customData.authToken = await createToken(); });