[Video] More tweaks to AVAudioSession
options (#4910)
This commit is contained in:
parent
dd0d50a6f0
commit
5bfe5aa503
8 changed files with 74 additions and 10 deletions
|
@ -8,14 +8,26 @@ public class ExpoPlatformInfoModule: Module {
|
|||
return UIAccessibility.isReduceMotionEnabled
|
||||
}
|
||||
|
||||
Function("setAudioCategory") { (audioCategoryString: String) in
|
||||
let audioCategory = AVAudioSession.Category(rawValue: audioCategoryString)
|
||||
try? AVAudioSession.sharedInstance().setCategory(audioCategory)
|
||||
}
|
||||
|
||||
Function("setAudioMixWithOthers") { (mixWithOthers: Bool) in
|
||||
var options: AVAudioSession.CategoryOptions
|
||||
let currentCategory = AVAudioSession.sharedInstance().category
|
||||
if mixWithOthers {
|
||||
options = [.mixWithOthers]
|
||||
} else {
|
||||
options = []
|
||||
options = [.duckOthers]
|
||||
}
|
||||
try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, mode: .default, options: options)
|
||||
try? AVAudioSession
|
||||
.sharedInstance()
|
||||
.setCategory(
|
||||
currentCategory,
|
||||
mode: .default,
|
||||
options: options
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue