隐藏音量级别弹出 MPMusicPlayerController Xcode
我正在使用 MPMusicPlayerController 在我的应用程序中播放 mp3 列表。
唯一的问题是,当我根据应用程序配置设置音量级别时,会弹出“音量级别”。
我试图找到任何财产来隐藏它,但我没有找到。
我使用的代码是:
if (audioPlayer)
if ([audioPlayer isPlaying])
[audioPlayer stop];
self.musicPlayer = [MPMusicPlayerController applicationMusicPlayer];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handlePlaybackStateChanged:) name:MPMusicPlayerControllerPlaybackStateDidChangeNotification object:self.musicPlayer];
[self.musicPlayer beginGeneratingPlaybackNotifications];
[self.musicPlayer setAccessibilityElementsHidden:YES];
self.musicPlayer.volume = volume;
[self.musicPlayer setQueueWithItemCollection:mediaItemCollection];
self.musicPlayer.repeatMode = MPMusicRepeatModeAll;
[self.musicPlayer play];
我的问题是,有什么方法可以避免这种弹出窗口吗?
谢谢。
I'm using MPMusicPlayerController to play a list of mp3 in my app.
The only problem is when I set the volume level, according with app configuration, appears a Volume Level pop up.
I tried to find any property in order to hide it, but I didn't find.
The code I'm using is:
if (audioPlayer)
if ([audioPlayer isPlaying])
[audioPlayer stop];
self.musicPlayer = [MPMusicPlayerController applicationMusicPlayer];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handlePlaybackStateChanged:) name:MPMusicPlayerControllerPlaybackStateDidChangeNotification object:self.musicPlayer];
[self.musicPlayer beginGeneratingPlaybackNotifications];
[self.musicPlayer setAccessibilityElementsHidden:YES];
self.musicPlayer.volume = volume;
[self.musicPlayer setQueueWithItemCollection:mediaItemCollection];
self.musicPlayer.repeatMode = MPMusicRepeatModeAll;
[self.musicPlayer play];
My question is, Any way to avoid this pop up?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在其他帖子中找到了此问题的解决方法
但是,没有直接的方法来执行此操作而不使用 MPVolumeView“不可见”吗?
对不起 :)
I found a workaround for this problem in other post
But, there is not a direct way to perform that without using MPVolumeView "invisible"?
Sorry :)