<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MusicKit",
  "identifier" : "/documentation/MusicKit/MusicPlayer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "MusicKit"
    ],
    "preciseIdentifier" : "s:8MusicKit0A6PlayerC"
  },
  "title" : "MusicPlayer"
}
-->

# MusicPlayer

An object your app uses to play music.

```
class MusicPlayer
```

## Topics

### Classes

[`class Queue`](/documentation/MusicKit/MusicPlayer/Queue)

A representation of the playback queue for a music player.

[`class State`](/documentation/MusicKit/MusicPlayer/State-swift.class)

An object that exposes the observable properties of a music player.

### Instance Properties

[`var isPreparedToPlay: Bool`](/documentation/MusicKit/MusicPlayer/isPreparedToPlay)

A Boolean value that indicates whether a music player is ready to play.

[`var playbackTime: TimeInterval`](/documentation/MusicKit/MusicPlayer/playbackTime)

The current playback time, in seconds, of the current entry.

[`let state: MusicPlayer.State`](/documentation/MusicKit/MusicPlayer/state-swift.property)

An object that exposes the observable properties of the music player.

### Instance Methods

[`func beginSeekingBackward()`](/documentation/MusicKit/MusicPlayer/beginSeekingBackward())

Begins seeking backward through the music content.

[`func beginSeekingForward()`](/documentation/MusicKit/MusicPlayer/beginSeekingForward())

Begins seeking forward through the music content.

[`func endSeeking()`](/documentation/MusicKit/MusicPlayer/endSeeking())

Ends forward and backward seeking through the music content.

[`func pause()`](/documentation/MusicKit/MusicPlayer/pause())

Pauses playback of the current entry.

[`func play() async throws`](/documentation/MusicKit/MusicPlayer/play())

Initiates playback from the current queue.

[`func prepareToPlay() async throws`](/documentation/MusicKit/MusicPlayer/prepareToPlay())

Prepares the current queue for playback, interrupting any active
(nonmixable) audio sessions.

[`func restartCurrentEntry()`](/documentation/MusicKit/MusicPlayer/restartCurrentEntry())

Restarts playback at the beginning of the currently playing entry.

[`func skipToNextEntry() async throws`](/documentation/MusicKit/MusicPlayer/skipToNextEntry())

Starts playback of the next entry in the playback queue.

[`func skipToPreviousEntry() async throws`](/documentation/MusicKit/MusicPlayer/skipToPreviousEntry())

Starts playback of the previous entry in the playback queue.

[`func stop()`](/documentation/MusicKit/MusicPlayer/stop())

Ends playback of the current entry.

### Enumerations

[`enum PlaybackStatus`](/documentation/MusicKit/MusicPlayer/PlaybackStatus)

The music player playback status modes.

[`enum RepeatMode`](/documentation/MusicKit/MusicPlayer/RepeatMode)

The repeat modes for the music player.

[`enum ShuffleMode`](/documentation/MusicKit/MusicPlayer/ShuffleMode)

The shuffle modes for the music player.

[`enum Transition`](/documentation/MusicKit/MusicPlayer/Transition)

The transition applied between playing items.

## Relationships

### Inherited By

[`ApplicationMusicPlayer`](/documentation/MusicKit/ApplicationMusicPlayer)

[`SystemMusicPlayer`](/documentation/MusicKit/SystemMusicPlayer)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)