diff --git a/PlayerUI/Views/PUIPlayerView.swift b/PlayerUI/Views/PUIPlayerView.swift index 09226c51..16fd4ba8 100644 --- a/PlayerUI/Views/PUIPlayerView.swift +++ b/PlayerUI/Views/PUIPlayerView.swift @@ -802,7 +802,14 @@ public final class PUIPlayerView: NSView { } } + fileprivate var activity: NSObjectProtocol? + @IBAction public func pause(_ sender: Any?) { + if let activity = self.activity { + ProcessInfo.processInfo.endActivity(activity) + self.activity = nil + } + if isPlayingExternally { currentExternalPlaybackProvider?.pause() } else { @@ -811,6 +818,8 @@ public final class PUIPlayerView: NSView { } @IBAction public func play(_ sender: Any?) { + activity = ProcessInfo.processInfo.beginActivity(options: [.idleDisplaySleepDisabled, .idleSystemSleepDisabled, .userInitiated], reason: "Playing WWDC session video") + if isPlayingExternally { currentExternalPlaybackProvider?.play() } else {