objective-c - iOS 悦跑圈跑步过程中调节媒体音量,如何实现
怪我咯
怪我咯 2017-05-02 09:32:13
0
1
1104

要实现悦跑圈跑步过程中始终调节媒体音量(前提系统设置中没有禁掉按钮调节系统音量),目前知道AudioSession在整个跑步过程中SetActive为YES即可,但是第三方音乐(网易云音乐)播放过程中会导致播放停止,使用
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionDuckOthers error:nil];语音播放完毕在调用

[[AVAudioSession sharedInstance] setActive:NO
                                       withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
                                             error:&error];

然后再调用 [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
这样是可以实现,但是频繁调用会导致AVAudioSession Error,播放延迟,有没有别的思路?

怪我咯
怪我咯

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

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!