objective-c - How to adjust the media volume during iOS Joypao Circle running
怪我咯
怪我咯 2017-05-02 09:32:13
0
1
1244

To realize that the media volume can always be adjusted during the Yue Pao Circle running (provided that the button is not disabled in the system settings to adjust the system volume), it is currently known that AudioSession SetActive is YES during the entire running process, but third-party music (NetEase Cloud Music) will cause playback to stop during playback. Use
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionDuckOthers error:nil]; to call

after the voice playback is completed.
[[AVAudioSession sharedInstance] setActive:NO
                                       withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
                                             error:&error];

Then call [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
This can be achieved, but frequent calls will cause AVAudioSession Error and playback delay. Are there any other ideas?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
Ty80

I found the problem. It was my mistake to use AudioSession. There is only one AudioSession for the entire system. When you need to set Active, you need to determine whether there is third-party music playing

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template