# DVR

For live streams, ByteArk Player SDK for iOS supports DVR, which lets viewers seek back within the live window and jump back to the live edge. DVR is opt-in and applies only to live content.

# Enable DVR

Turn DVR on with .dvr(enabled:) on ByteArkPlayerConfigBuilder. It is disabled by default.

let config = try ByteArkPlayerConfigBuilder(licenseKey: "<YOUR_LICENSE_KEY>")
  .item(item)
  .dvr(enabled: true)
  .build()
1
2
3
4

DVR engages only for a seekable live stream whose window is long enough to pass the engagement threshold. While active, the controls unlock seeking across the window instead of locking to the live edge.

# Seek within the live window

// Seek backward by the configured seek interval
player.seekBackward()
// Seek forward by the configured seek interval
player.seekForward()
// Return to the live edge (no-op when DVR is inactive)
player.seekToLive()
1
2
3
4
5
6
7
8

# Inspect DVR state

isDVRActive reports whether DVR is currently active, and dvrWindow exposes the seekable span.

// Whether DVR is currently active
let active: Bool = player.isDVRActive
// The seekable window, or nil when DVR is inactive
if let window = player.dvrWindow {
  let start = window.start        // oldest seekable position (seconds)
  let end = window.end            // live edge (seconds)
  let duration = window.duration  // seekable length (seconds)
}
1
2
3
4
5
6
7
8
9

# API

API Description
.dvr(enabled:) Config builder flag that opts a live stream into DVR (default false)
func seekToLive() Return playback to the live edge (no-op when DVR is inactive)
func seekForward() Seek forward by the configured seek interval
func seekBackward() Seek backward by the configured seek interval
var isDVRActive: Bool { get } Whether DVR is currently active (enabled, live stream, and window past the threshold)
var dvrWindow: DVRWindow? { get } The seekable window, or nil when DVR is inactive

# DVRWindow

Property Type Description
start TimeInterval Oldest seekable position (the back of the window)
end TimeInterval Newest seekable position (the live edge)
duration TimeInterval Seekable length of the window (end - start)