---
title: RemoteMediaSession
framework: nowplaying
role: symbol
role_heading: Class
path: nowplaying/remotemediasession
---

# RemoteMediaSession

A session that manages remote media playback across devices.

## Declaration

```swift
@MainActor class RemoteMediaSession<Attributes> where Attributes : RemoteMediaSessionAttributes
```

## Mentioned in

Publishing remote media sessions

## Overview

Overview Use a remote session to represent media playback sessions happening outside of this device, but that your app wants to donate to the system so they may appear in the system’s Now Playing interface. Use this API when your app has information about the remote session and wants to signal to the system that playback has started (using start(attributes:)) or something about the session has changed (using update(_:)). You can also donate remote sessions to the system through push notifications, for example when playback starts while your app isn’t running. In that case, use APNs to send a push notification to the user’s device that informs the system of a start, update, or end event. The following example shows how to start a session: struct MySessionAttributes: RemoteMediaSessionAttributes {     let id: String     let trackID: String }

let attributes = MySessionAttributes(id: "session-123", trackID: "track-123") let session = try await RemoteMediaSession.start(attributes: attributes) After starting a session, update its attributes or end it: // Update the session attributes try await session.update(newAttributes)

// End the session when playback completes try await session.end()

## Topics

### Instance Properties

- [id](nowplaying/remotemediasession/id.md)
- [isSystemPrimary](nowplaying/remotemediasession/issystemprimary.md)

### Instance Methods

- [end()](nowplaying/remotemediasession/end().md)
- [requestToBecomeSystemPrimary()](nowplaying/remotemediasession/requesttobecomesystemprimary().md)
- [update(_:)](nowplaying/remotemediasession/update(_:).md)

### Type Properties

- [pushToStartToken](nowplaying/remotemediasession/pushtostarttoken.md)
- [pushToStartTokenUpdates](nowplaying/remotemediasession/pushtostarttokenupdates.md)

### Type Methods

- [sessions()](nowplaying/remotemediasession/sessions().md)
- [start(attributes:)](nowplaying/remotemediasession/start(attributes:).md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [Escapable](swift/escapable.md)
- [Identifiable](swift/identifiable.md)
- [Observable](observation/observable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Remote sessions

- [Publishing remote media sessions](nowplaying/publishing-remote-media-sessions.md)
- [RemoteMediaSessionRepresentable](nowplaying/remotemediasessionrepresentable.md)
- [RemoteMediaSessionExtension](nowplaying/remotemediasessionextension.md)
- [RemoteMediaSessionExtensionConfiguration](nowplaying/remotemediasessionextensionconfiguration.md)
- [RemoteMediaSessionAttributes](nowplaying/remotemediasessionattributes.md)
- [RemoteMediaSessionError](nowplaying/remotemediasessionerror.md)
- [MediaDevice](nowplaying/mediadevice.md)
