One Logo Pool Ball
NowPlaying · IOS API REFERENCE

MediaSession

class · iOS 27.0+ · SDK 27.1

@MainActor class MediaSession<Representable> where Representable : MediaSessionRepresentable

A local Now Playing session that publishes metadata and commands to the system. Use a session to represent media playback happening on the current device. The session automatically observes your ``MediaSessionRepresentable`` model and syncs changes to the system's Now Playing interface. For more information, see <doc:publishing-media-sessions> Create a session by providing a session representable: ```swift let session = MediaSession(myModel) ``` Call ``requestToBecomeApplicationPrimary()`` to make this your app's primary Now Playing session when you want to display playback controls: ```swift try await session.requestToBecomeApplicationPrimary() ```

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

7 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

MediaSession.id

The containing type needs Swift generic type arguments. (no canonical witness for Representable)

MediaSession.isApplicationPrimary

The containing type needs Swift generic type arguments. (no canonical witness for Representable)

MediaSession.canBecomeApplicationPrimary

The containing type needs Swift generic type arguments. (no canonical witness for Representable)

MediaSession.isSystemPrimary

The containing type needs Swift generic type arguments. (no canonical witness for Representable)

MediaSession.init(_:)

This declaration needs Swift generic type arguments. (no canonical witness for Representable)

MediaSession.requestToBecomeApplicationPrimary()

The containing type needs Swift generic type arguments. (no canonical witness for Representable)

MediaSession.requestToBecomeSystemPrimary()

The containing type needs Swift generic type arguments. (no canonical witness for Representable)

All NowPlaying types →