Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVAudioSession获取和释放音频焦点都会卡一下UI #249

Open
JC-Sung opened this issue Mar 4, 2021 · 0 comments
Open

AVAudioSession获取和释放音频焦点都会卡一下UI #249

JC-Sung opened this issue Mar 4, 2021 · 0 comments

Comments

@JC-Sung
Copy link

JC-Sung commented Mar 4, 2021

有没有发现当是视频广告时,点击跳过按钮,界面会卡一下
原因是stopVideoPlayer这个方法里释放音频的方法就会卡一下UI

这样写就不卡,Apple文档关于AVAudioSession有写

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[AVAudioSession sharedInstance] setActive:NO withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];
});

获取音频焦点也是一样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant