Skip to content

Commit

Permalink
Reader takes over the audio control (FolioReader#322)
Browse files Browse the repository at this point in the history
- Removed code that sets reader audio session to active immediately after pod init
- Added audio session interruption observer to update player/player menu state
- Closes #321
  • Loading branch information
arthurlataks authored and hebertialmeida committed Mar 5, 2018
1 parent 1b8c530 commit a73633b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source/FolioReaderAudioPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ open class FolioReaderAudioPlayer: NSObject {
// this is needed to the audio can play even when the "silent/vibrate" toggle is on
let session = AVAudioSession.sharedInstance()
try? session.setCategory(AVAudioSessionCategoryPlayback)
try? session.setActive(true)

NotificationCenter.default.addObserver(self,
selector: #selector(pause),
name: .AVAudioSessionInterruption,
object: session
)

self.updateNowPlayingInfo()
}
Expand Down

0 comments on commit a73633b

Please sign in to comment.