Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

WebKit 4 min read How-to mediumAdept

How to use Media Source Extensions with AirPlay

Media Source Extensions and Apple's Managed Media Source can't be used with AirPlay because they feed binary blobs into a SourceBuffer, and AirPlay needs a real playback URL. The workaround is to give the video element multiple <source> children. Put the object URL created from the MediaSource first and an AirPlay-compatible HLS URL second. Safari then shows the AirPlay button and switches to the HLS source when the user casts. The example code feature-detects ManagedMediaSource with a fallback to MediaSource, and it uses the startstreaming event to load segments when that event is available.

Related posts

  • WebKit Features in Safari 17.1

    WebKit easyNovice

    Safari 17.1 brings the Managed Media Source API to iPhone, a power-efficient alternative to Media Source Extensions for adaptive bitrate streaming. It hands more buffer and network management to the browser and requires an AirPlay source alternative or explicitly disabled remote playback. The release also adds storage.session.setAccessLevel for Safari extensions, with storage.session restricted to trusted contexts by default. Bug fixes cover accessibility, CSS, RegExp look-behind, HLS and MediaSource playback, IntersectionObserver performance, popovers in shadow DOM and WebGL context loss.

  • What the iPhone Duo means for web development

    Mux mediumAdept

    Safari on the foldable iPhone Duo exposes the Device Posture API and Viewport Segments API behind WebKit feature flags. They let pages detect a folded posture via `navigator.devicePosture` or `@media (device-posture: folded)` and position content per screen segment with `env(viewport-segment-*)` variables. Using these plus a flagged Fullscreen API, a Netflix-style folded video player was built from Video.js v10 components, with video on the top half and tiled controls on the bottom. A blurred, mirrored reflection is drawn by copying frames to a small canvas via requestVideoFrameCallback, since -webkit-box-reflect doesn't work on video in iOS Safari. In practice it needs three feature flags on iOS, and Chromium on a Pixel Fold clips fullscreen content to the top half, so the design isn't shippable today.

  • Meet Web Push

    WebKit easyNovice

    Safari 16 on macOS Ventura supports Web Push through the W3C Push API, Notifications API and Service Workers, with iOS and iPadOS support planned for 2023. Standards-compliant code works without joining the Apple Developer Program. Sites should replace browser sniffing with feature detection and allow push endpoints on any push.apple.com subdomain. Subscriptions require a user gesture and userVisibleOnly=true, and sites that fail to show a notification for each push lose their subscription. A new webpushd LaunchAgent bridges subscriptions to the Apple Push Notification service and wakes the right app to deliver messages to service workers, so pushes arrive even when Safari isn't running.

  • Safari on Apple HomeView

    WebKit mediumAdept

    Safari now runs on Apple HomeView, a square 7-inch display driven by voice and touch, and most well-built sites need no changes to work there. To get the most out of it, mark up recipes with schema.org Recipe JSON-LD so Safari can build its step-by-step cooking view, and supply video captions as WebVTT in track elements. Avoid user-agent sniffing, because HomeView reports an iOS UA; use feature detection and Smart App Banners instead. Use semantic, labeled controls so voice input works, and handle short, square viewports (for example, cap modal height at 90svh). Test in landscape on a phone or in Responsive Design Mode at 448×364.

  • Building an AI WebTV

    Hugging Face mediumAdept

    The AI WebTV is an experimental 24/7 stream of short clips generated by open-source text-to-video and music models. ChatGPT expands a human-written theme into per-shot prompts. Zeroscope V2 then generates 576x320 clips, and Zeroscope XL upscales them to 1024x576 using the same prompt. FILM frame interpolation smooths the clips and MusicGen adds a soundtrack. A Node/TypeScript orchestrator calls these models on Gradio Spaces via @gradio/client, and FFmpeg concatenates an ffconcat playlist into a low-latency FLV stream sent to an RTMP server (node-media-server). Prompting lessons include specifying camera and subject motion and direction, and repeating full details in every prompt for cross-scene consistency. Frame interpolation can hide rendering artifacts, while known failure modes include reversed motion and prompt words like "IMAX" appearing as text in frames.

The quest for software engineering knowledge.

Look:
Layout: