Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resume the audio in ios?

I am using Audioplayer for playing audio file which is 5-10 secs. My app allows background music of other apps. While playing my audio I am deactivating the other music using

 [[AVAudioSession sharedInstance] setActive:YES withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];

After completion of my audio, I want to play the deactivated music.

Is this possible in AVAudioPlayer & AVAudioSession? Or else which framework supports for this resuming functionality?

like image 478
user40910 Avatar asked Apr 28 '15 12:04

user40910


Video Answer


1 Answers

After playing your sounds, deactivate your AVAudioSession

[[AVAudioSession sharedInstance] setActive:NO withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];
like image 87
gabuh Avatar answered Oct 11 '22 03:10

gabuh