Manually setup AVAudioSession (allow background music playback)

This commit is contained in:
Marc Rousavy
2021-02-23 10:27:31 +01:00
parent bcdf30fa9d
commit 49e5dd67dc
3 changed files with 31 additions and 13 deletions

View File

@@ -133,17 +133,25 @@ enum FormatError {
}
}
enum SessionError: String {
case cameraNotReady = "camera-not-ready"
enum SessionError {
case cameraNotReady
case audioSessionSetupFailed(reason: String)
var code: String {
return rawValue
switch self {
case .cameraNotReady:
return "camera-not-ready"
case .audioSessionSetupFailed:
return "audio-session-setup-failed"
}
}
var message: String {
switch self {
case .cameraNotReady:
return "The Camera is not ready yet! Wait for the onInitialized() callback!"
case let .audioSessionSetupFailed(reason):
return "The audio session failed to setup! \(reason)"
}
}
}