---
title: "setEndTime(_:for:)"
framework: mediaplayer
role: symbol
role_heading: Instance Method
path: "mediaplayer/mpmusicplayermediaitemqueuedescriptor/setendtime(_:for:)"
---

# setEndTime(_:for:)

The time the designated media item is to stop playing.

## Declaration

```swift
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.

## See Also

### Setting start and end times

- [setStartTime(_:for:)](mediaplayer/mpmusicplayermediaitemqueuedescriptor/setstarttime(_:for:).md)
