Skip to content

Commit

Permalink
FEC-12301 Expose AVPlayer preventsDisplaySleepDuringVideo (#460)
Browse files Browse the repository at this point in the history
* FEC-12301 Fix, available from tvOS 12.0
  • Loading branch information
x-NR-x authored Jun 14, 2022
1 parent 6444d4a commit 919d44b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Classes/Player/PKPlayerSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ enum PlayerSettingsType {

/// AVPlayer.preventsDisplaySleepDuringVideoPlayback representation for PlayKit player settings.
/// Setting this property to NO does not force the display to sleep, it simply stops preventing display sleep.
/// Available only from iOS 12.0
/// @available(iOS 12.0, tvOS 12.0, *)
@objc public var preventsDisplaySleepDuringVideoPlayback: Bool = true {
didSet {
self.onChange?(.preventsDisplaySleepDuringVideoPlayback(preventsDisplaySleepDuringVideoPlayback))
Expand Down
4 changes: 2 additions & 2 deletions Classes/Player/PlayerWrapper/AVPlayerWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ open class AVPlayerWrapper: NSObject, PlayerEngine {
self.currentPlayer.currentItem?.configuredTimeOffsetFromLive = time
}
case .preventsDisplaySleepDuringVideoPlayback(let prevent):
if #available(iOS 12.0, *) {
if #available(iOS 12.0, tvOS 12.0, *) {
DispatchQueue.main.async {
self.currentPlayer.preventsDisplaySleepDuringVideoPlayback = prevent
}
Expand Down Expand Up @@ -292,7 +292,7 @@ open class AVPlayerWrapper: NSObject, PlayerEngine {
self.addAssetRefreshObservers()
}

if #available(iOS 12.0, *) {
if #available(iOS 12.0, tvOS 12.0, *) {
DispatchQueue.main.async {
self.currentPlayer.preventsDisplaySleepDuringVideoPlayback = settings.preventsDisplaySleepDuringVideoPlayback
}
Expand Down

0 comments on commit 919d44b

Please sign in to comment.