How SharePlay Synchronizes Playback on iOS 15
Apple introduced SharePlay in iOS 15 to allow users to watch movies,
listen to music, and interact with apps together during FaceTime calls.
To synchronize media playback across multiple devices with varying
network latencies, iOS 15 uses the GroupActivities framework in tandem
with AVFoundation's
AVPlayerPlaybackCoordinator. Rather than streaming raw
frames between participants, SharePlay synchronizes state commands and
establishes a common reference clock, dynamically compensating for
latency differences so that all participants experience playback
simultaneously.
Decentralized Media Delivery via Independent Streams
SharePlay does not transmit audio or video data peer-to-peer over the FaceTime connection. Instead, every participant's device streams the content directly and independently from the content provider's Content Delivery Network (CDN). The FaceTime channel is reserved exclusively for lightweight synchronization metadata and coordination signals. This architecture ensures that network bandwidth on the local FaceTime connection is not consumed by high-definition video, allowing the system to focus entirely on precision timing messages.
The Role of
AVPlayerPlaybackCoordinator
In iOS 15, Apple introduced AVPlayerPlaybackCoordinator,
an abstraction layer built on top of AVPlayer. This
coordinator intercepts typical media playback controls—such as play,
pause, seek, and rate changes—and prevents them from executing
immediately on the local device.
When a user initiates an action (like pressing play), the coordinator
evaluates the local media player state and prepares a synchronized
playback command. This command is broadcast to the group via the
GroupSession established by the GroupActivities
framework.
Shared Reference Clock and Round-Trip Time Calculation
To synchronize devices with uneven latencies, SharePlay establishes a common reference clock across all participating devices.
- Time Offset Calculation: The framework continuously calculates the round-trip time (RTT) and network jitter between each peer and Apple's coordination servers.
- Synchronized Timestamps: Using these measurements,
the system maps each device's local clock to a unified timeline using
high-precision Core Media time (
CMTime).
Because every device understands this shared time baseline, playback commands are scheduled to occur at a specific future reference time rather than executed instantly.
Scheduled Execution and Coordinated Waiting
When an action like playback is triggered:
- Target Timestamp Selection: The coordinator determines an execution timestamp set far enough into the future (\(T_{target} = T_{current} + \text{latency buffer}\)) to allow the device with the highest latency to receive the packet, buffer the upcoming frames, and prepare its playback pipeline.
- Coordinated Waiting: If a participant's device encounters network degradation, buffering issues, or high latency that prevents it from meeting the target timestamp, it notifies the coordinator. The coordinator then instructs the other participants to enter a "waiting" state. The faster devices will automatically pause or hold playback at that frame until the lagging participant confirms it is ready to proceed.
Micro-Rate Adjustments for Drift Correction
Small timing drifts naturally occur during long playback sessions due
to minor hardware clock discrepancies and fluctuating network buffers.
Rather than performing jarring audio skips or video seeks to correct
these micro-variations, AVPlayerPlaybackCoordinator
dynamically adjusts the playback rate.
If a device falls slightly behind by a few milliseconds, the system subtly accelerates the playback rate (for example, to 1.02x) until the timing matches the group baseline, then smoothly returns to 1.0x. This automatic drift correction keeps all viewers frame-accurate without causing noticeable disruptions to the media experience.