---
title: "startWithCompletionHandler:"
framework: avsystemrouting
role: symbol
role_heading: Instance Method
path: "avsystemrouting/avsystemroutesession-5i6j6/startwithcompletionhandler:"
---

# startWithCompletionHandler:

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

## Declaration

```occ
- (void) startWithCompletionHandler:(void (^)(NSError *launchError, AVSystemRouteMediaSession *mediaSession)) completionHandler;
```

## Parameters

- `completionHandler`: A completion handler called when the launch operation completes. The handler receives two parameters: - launchError: An error object if the launch failed, or nil on success. - mediaSession: A media session object for communicating with the remote device. Access its doc://com.apple.avsystemrouting/documentation/AVSystemRouting/AVSystemRouteMediaSession-4mo0j/dataChannel property to send and receive data between your app and the remote application. Access its doc://com.apple.avsystemrouting/documentation/AVSystemRouting/AVSystemRouteMediaSession-4mo0j/playbackControl property to send and receive playback commands between your app and the remote application. For doc://com.apple.avsystemrouting/documentation/AVSystemRouting/AVSystemRouteLaunchMode/player, doc://com.apple.avsystemrouting/documentation/AVSystemRouting/AVSystemRouteMediaSession-4mo0j/dataChannel is nil.

## Discussion

Discussion Call this method 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 AVSystemRouteLaunchMode.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 AVSystemRouteLaunchMode.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. important: Call stop when playback ends to properly clean up the remote session. note: This method operates asynchronously. The completion handler may be called on a background queue, so dispatch to the main queue if you need to update UI.
