<!--
{
  "availability" : [
    "iOS: 10.1.0 -",
    "iPadOS: 10.1.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaPlayer",
  "identifier" : "/documentation/MediaPlayer/MPMusicPlayerMediaItemQueueDescriptor/setEndTime(_:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Media Player"
    ],
    "preciseIdentifier" : "c:objc(cs)MPMusicPlayerMediaItemQueueDescriptor(im)setEndTime:forItem:"
  },
  "title" : "setEndTime(_:for:)"
}
-->

# setEndTime(_:for:)

The time the designated media item is to stop playing.

```
func setEndTime(_ endTime: TimeInterval, for mediaItem: MPMediaItem)
```

## Parameters

`endTime`

The <doc://com.apple.documentation/documentation/Foundation/TimeInterval> describing when the media item stops playing.

`mediaItem`

The media item in the queue that has a changed end time.

## Discussion

---

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)