mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-03 03:11:47 +00:00
fix(ios): fixed audio focus change on iOS (#4811)
* fix: fixed audio focus change on ios * Fix formatting for audio session category options --------- Co-authored-by: Kamil Moskała <91079590+moskalakamil@users.noreply.github.com>
This commit is contained in:
@@ -155,7 +155,7 @@ class VideoManager {
|
|||||||
|
|
||||||
configureAudioSession()
|
configureAudioSession()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func configureAudioSession() {
|
private func configureAudioSession() {
|
||||||
let audioSession = AVAudioSession.sharedInstance()
|
let audioSession = AVAudioSession.sharedInstance()
|
||||||
var audioSessionCategoryOptions: AVAudioSession.CategoryOptions = audioSession.categoryOptions
|
var audioSessionCategoryOptions: AVAudioSession.CategoryOptions = audioSession.categoryOptions
|
||||||
@@ -194,17 +194,19 @@ class VideoManager {
|
|||||||
)
|
)
|
||||||
|
|
||||||
let audioMixingMode = determineAudioMixingMode()
|
let audioMixingMode = determineAudioMixingMode()
|
||||||
|
|
||||||
|
|
||||||
|
audioSessionCategoryOptions.remove(.duckOthers)
|
||||||
|
audioSessionCategoryOptions.remove(.mixWithOthers)
|
||||||
|
|
||||||
switch audioMixingMode {
|
switch audioMixingMode {
|
||||||
case .mixwithothers:
|
case .mixwithothers:
|
||||||
audioSessionCategoryOptions.insert(.mixWithOthers)
|
audioSessionCategoryOptions.insert(.mixWithOthers)
|
||||||
case .donotmix:
|
|
||||||
audioSessionCategoryOptions.remove(.mixWithOthers)
|
|
||||||
case .duckothers:
|
case .duckothers:
|
||||||
audioSessionCategoryOptions.insert(.duckOthers)
|
audioSessionCategoryOptions.insert(.duckOthers)
|
||||||
case .auto:
|
case .auto, .donotmix:
|
||||||
audioSessionCategoryOptions.remove(.mixWithOthers)
|
// Do nothing as we already cleared the options
|
||||||
audioSessionCategoryOptions.remove(.duckOthers)
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|||||||
Reference in New Issue
Block a user