CameraEngine
CameraEngine copied to clipboard
how to play sound with preview layer?
if i have an app open thats already playing sound how do i make it so the preview layer doesnt stop?
Just leaving this for everyone as I got it to work..
Call this right before setupSession()
func setupBackgroundAudioPreference() {
do{
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord,
with: [.defaultToSpeaker, .mixWithOthers ])
try AVAudioSession.sharedInstance().setActive(true)
session.automaticallyConfiguresApplicationAudioSession = false
}
catch {
print("Could not set audio preference..")
}
}
}
@danieldelouya any other recommendation? It's strangely working for me the first time I open the camera but not the second one.