---
title: "init(state:defaultPlaybackRate:elapsedTime:timestamp:)"
framework: nowplaying
role: symbol
role_heading: Initializer
path: "nowplaying/mediaplaybacksnapshot/init(state:defaultplaybackrate:elapsedtime:timestamp:)"
---

# init(state:defaultPlaybackRate:elapsedTime:timestamp:)

Creates a playback snapshot with the specified state and timing.

## Declaration

```swift
init(state: MediaPlaybackSnapshot.PlaybackState, defaultPlaybackRate: Float = 1.0, elapsedTime: TimeInterval? = nil, timestamp: Date? = nil)
```

## Parameters

- `state`: The current playback state.
- `defaultPlaybackRate`: The baseline rate the player returns to after temporary rate changes. Defaults to 1.0.
- `elapsedTime`: The current elapsed time, in seconds.
- `timestamp`: The wall-clock time associated with elapsedTime, used to extrapolate the current position.

## Discussion

Discussion note: When state is .playing(let rate), rate must be finite and non-zero. note: defaultPlaybackRate must be finite and greater than 0.
