Contents

start()

Starts the session and initiates media playback on the remote device.

Declaration

final func start() async throws -> AVSystemRouteMediaSession

Mentioned in

Return Value

An AVSystemRouteMediaSession for communicating with the remote device. Access its dataChannel property to send and receive data between your app and the remote application. Access its playbackControl property to send and receive playback commands between your app and the remote application. For AVSystemRoute.LaunchMode.player, dataChannel is nil.

Discussion

Call this function to begin the playback session after adding it to an AVSystemRoute. The session uses the URL and launch mode specified during initialization to start playback on the remote device.

When using AVSystemRoute.LaunchMode.application, your app must declare supported protocol identifiers in the MDESupportedProtocols key in your Info.plist file. These identifiers enable the system to establish communication between your app and its counterpart on the remote device.

After a successful launch with AVSystemRoute.LaunchMode.application, the returned AVSystemRouteMediaSession provides access to a dataChannel and a playbackControl. Use these objects to send playback commands, state updates, or custom messages between your app and the remote application.

Report playback metadata to MPNowPlayingInfoCenter to ensure the system displays accurate information about the current media across a person’s devices.