Error when Audio Input is in use by another app (#111)

* Remove Audio Device if it failed to configure

* Add `audio-in-use-by-other-app` error

* Try removing on interruption

* Format code

* Make error more clear
This commit is contained in:
Marc Rousavy
2021-03-29 11:32:00 +02:00
committed by GitHub
parent 12f6ab5217
commit 1558dd2f15
4 changed files with 52 additions and 31 deletions

View File

@@ -154,6 +154,7 @@ enum FormatError {
enum SessionError {
case cameraNotReady
case audioSessionSetupFailed(reason: String)
case audioInUseByOtherApp
// MARK: Internal
@@ -163,6 +164,8 @@ enum SessionError {
return "camera-not-ready"
case .audioSessionSetupFailed:
return "audio-session-setup-failed"
case .audioInUseByOtherApp:
return "audio-in-use-by-other-app"
}
}
@@ -172,6 +175,8 @@ enum SessionError {
return "The Camera is not ready yet! Wait for the onInitialized() callback!"
case let .audioSessionSetupFailed(reason):
return "The audio session failed to setup! \(reason)"
case .audioInUseByOtherApp:
return "The audio session is already in use by another app with higher priority!"
}
}
}