Instance Property

preventsDisplaySleepDuringVideoPlayback

A Boolean value that indicates whether video playback prevents display and device sleep.

Declaration

var preventsDisplaySleepDuringVideoPlayback: Bool { get set }

Discussion

The default value for this property on iOS is true. The defalut value for this property on macOS is false. Setting this property to false does not force the display to sleep, it just doesn't stop the display from going to sleep. Other apps or frameworks within your app can still prevent the display from going to sleep for other reasons.

See Also

Managing Playback

func play()

Begins playback of the current item.

func pause()

Pauses playback of the current item.

var rate: Float

The current playback rate.

var actionAtItemEnd: AVPlayer.ActionAtItemEnd

The action to perform when the current player item has finished playing.

enum AVPlayer.ActionAtItemEnd

The actions a player should take when it finishes playing.

func replaceCurrentItem(with: AVPlayerItem?)

Replaces the current player item with a new player item.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software