我正在使用 AVQueuePlayer/AVFoundation 在 iOS 应用程序中播放音频文件。
我已经设置了 MPNowPlayingInfoCenter 的当前播放信息,例如专辑标题、艺术家、艺术品、
像这样
NSMutableDictionary *albumInfo = [[NSMutableDictionary alloc] init];
MPMediaItemArtwork *artworkP;
UIImage *artWork = [UIImage imageNamed:album.imageUrl];
[albumInfo setObject:album.title forKey:MPMediaItemPropertyTitle];
[albumInfo setObject:album.auther forKey:MPMediaItemPropertyArtist];
[albumInfo setObject:album.title forKey:MPMediaItemPropertyAlbumTitle];
[albumInfo setObject:artworkP forKey:MPMediaItemPropertyArtwork];
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:albumInfo]
还可以访问应用程序委托中的远程事件,以从锁定屏幕播放、暂停、下一个、上一个事件。
但搜索栏无法访问,即使我没有找到任何设置搜索属性的选项。
我想设置搜索属性并希望访问我的应用程序中的搜索滑块更改事件。
我相信支持向前和向后搜索的唯一方法是通过上一个/前进按钮(它们在按住时发送开始/结束搜索通知)。
UIEventSubtypeRemoteControlBeginSeekingBackward, UIEventSubtypeRemoteControlBeginSeekingForward,
UIEventSubtypeRemoteControlEndSeekingBackward, UIEventSubtypeRemoteControlEndSeekingForward
根据其他一些问题和文档,搜索栏只能通过苹果自己的应用程序访问(https://stackoverflow.com/a/20142141/535632 https://stackoverflow.com/a/20142141/535632, https://stackoverflow.com/a/20909875/535632 https://stackoverflow.com/a/20909875/535632)。根据最后一个答案,似乎有些应用程序(尤其是 Spotify)通过音乐播放器路由音乐以利用搜索栏。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)