Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Reader takes over the audio control #322

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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