ios - AVAudioEngine stops device's background audio -
i using avaudioengine
object, has many avaudioplayernodes
attached it. audio works fine, except stops audio iphone playing in background (i. e. itunes or music app).
when app opened, stops other background audio. there way allow background audio continue play? when app using avaudioplayernodes play audio itself?
music app has it's own audiosession, makes audio engine stops, had problem too, please restart after music app.
func stepb_startengine(){ if engine.running == false { { try engine.start() } catch let error { print(error) } } }
setup audiosettion also:
func setupaudiosession(){ do{ try avaudiosession.sharedinstance().setcategory(avaudiosessioncategoryambient, withoptions: avaudiosessioncategoryoptions.mixwithothers) try avaudiosession.sharedinstance().setactive(true, withoptions: avaudiosessionsetactiveoptions.notifyothersondeactivation) } catch let error { print(error) } }
Comments
Post a Comment