Skip to content

Commit

Permalink
Merge branch 'master' of github.com:insidegui/WWDC
Browse files Browse the repository at this point in the history
  • Loading branch information
insidegui committed Jun 8, 2017
2 parents acd4661 + 8047d87 commit 68f8f8b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions PlayerUI/Views/PUIPlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 68f8f8b

Please sign in to comment.