---
title: Playback commands
framework: nowplaying
role: collectionGroup
role_heading: API Collection
path: nowplaying/playback-commands
---

# Playback commands

Declare the playback controls your app supports.

## Overview

Overview Use MediaCommand to define the controls available for your Now Playing session. The system displays these controls on the Lock Screen, Control Center, and connected accessories. Each command takes an action closure that the system invokes when someone interacts with a control. Return an array of commands from your commands property. Create each command with a static factory method on MediaCommand: var commands: [MediaCommand] {     [         .play { self.play() },         .pause { self.pause() },         .next { self.next() }.enabled(hasNextTrack),         .previous { self.previous() }.enabled(hasPreviousTrack),         .seekToPosition { time in             self.seek(to: time)         },     ] } Use enabled(_:) to make a command available or unavailable based on your app’s state. Unavailable commands still appear in the interface, but the system doesn’t invoke their handler.

## Topics

### Creating commands

- [MediaCommand](nowplaying/mediacommand.md)
- [enabled(_:)](nowplaying/mediacommand/enabled(_:).md)

### Controlling playback

- [play(_:)](nowplaying/mediacommand/play(_:).md)
- [pause(_:)](nowplaying/mediacommand/pause(_:).md)
- [stop(_:)](nowplaying/mediacommand/stop(_:).md)
- [togglePlayPause(_:)](nowplaying/mediacommand/toggleplaypause(_:).md)

### Navigating commands

- [next(_:)](nowplaying/mediacommand/next(_:).md)
- [previous(_:)](nowplaying/mediacommand/previous(_:).md)
- [skipForward(preferredIntervals:_:)](nowplaying/mediacommand/skipforward(preferredintervals:_:).md)
- [skipBackward(preferredIntervals:_:)](nowplaying/mediacommand/skipbackward(preferredintervals:_:).md)

### Seeking

- [seekToPosition(_:)](nowplaying/mediacommand/seektoposition(_:).md)
- [seekForward(beginAction:endAction:)](nowplaying/mediacommand/seekforward(beginaction:endaction:).md)
- [seekBackward(beginAction:endAction:)](nowplaying/mediacommand/seekbackward(beginaction:endaction:).md)

### Changing playback modes

- [changePlaybackRate(supported:_:)](nowplaying/mediacommand/changeplaybackrate(supported:_:).md)
- [changeRepeatMode(current:supported:_:)](nowplaying/mediacommand/changerepeatmode(current:supported:_:).md)
- [changeShuffleMode(current:supported:_:)](nowplaying/mediacommand/changeshufflemode(current:supported:_:).md)
- [MediaCommand.RepeatMode](nowplaying/mediacommand/repeatmode.md)
- [MediaCommand.ShuffleMode](nowplaying/mediacommand/shufflemode.md)

### Providing feedback

- [feedback(title:shortTitle:status:_:)](nowplaying/mediacommand/feedback(title:shorttitle:status:_:).md)
- [MediaCommand.FeedbackStatus](nowplaying/mediacommand/feedbackstatus.md)

## See Also

### Playback

- [MediaPlaybackSnapshot](nowplaying/mediaplaybacksnapshot.md)
- [Content types and metadata](nowplaying/content-types-and-metadata.md)
