Skip to content

Commit

Permalink
AVAudioSession longForm policy is deprecated, use longFormAudio i…
Browse files Browse the repository at this point in the history
…nstead
  • Loading branch information
ricardopereira committed Jun 9, 2020
1 parent 8ad6af3 commit 51ac102
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Sodes/SodesAudio/PlaybackController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,25 @@ public class PlaybackController: NSObject {

let audioSession = AVAudioSession.sharedInstance()

if #available(iOS 11.0, *) {
if #available(iOS 13.0, *) {
do {
try audioSession.setCategory(.playback, mode: .spokenAudio, policy: .longFormAudio)
try audioSession.setActive(true)
}
catch {
print(error)
}
}
else if #available(iOS 11.0, *) {
do {
try audioSession.setCategory(.playback, mode: .spokenAudio, policy: .longForm)
try audioSession.setActive(true)
}
catch {
print(error)
}
} else {
}
else {
// Fallback on earlier versions
_ = try! audioSession.setCategory(.playback)
_ = try! audioSession.setMode(.spokenAudio)
Expand Down

0 comments on commit 51ac102

Please sign in to comment.