在锁定屏幕上设置和访问iOS搜索栏 [英] Setting and accessing iOS seek bar on lock screen

查看:216
本文介绍了在锁定屏幕上设置和访问iOS搜索栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用AVQueuePlayer / AVFoundation在iOS应用中播放音频文件。
i已经设置了MPNowPlayingInfoCenter现在播放的信息,如专辑标题,艺术家,艺术品,
像这样

I am playing a audio file in iOS app using AVQueuePlayer/AVFoundation. i have set the MPNowPlayingInfoCenter's now playing information like album title, artist, Artwork, like this

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]

还可以访问应用程序委托中的远程事件,以便从锁定屏幕播放,暂停,下一个,上一个事件。
但搜索栏无法访问,即使我没有找到任何设置搜索属性的选项。

and also accessing remote event in application delegate for play,pause, next, previous event from lock screen. But the seek bar is not accessible, even i didn't find any option to set seek property.

我想设置搜索属性,并希望在我的应用程序中访问搜索滑块更改事件。

i want to set seek property and want to access the seek slider change event in my app.

< img src =https://i.stack.imgur.com/qPFKf.pngalt =这是锁定屏幕的截屏。>

推荐答案

我认为支持前进和后退搜索的唯一方法是通过前一个/前进按钮(它们在按下时发送开始/结束寻求通知)。

I believe the only way to support forward and backward seeking is by the previous/advance buttons (they send a begin/end seeking notification when held down).

UIEventSubtypeRemoteControlBeginSeekingBackward, UIEventSubtypeRemoteControlBeginSeekingForward, 
UIEventSubtypeRemoteControlEndSeekingBackward, UIEventSubtypeRemoteControlEndSeekingForward

根据其他一些问题和文档,搜索栏只能通过Apple自己的应用程序访问( https:// stackoverflow .com / a / 20142141/535632 https://stackoverflow.com/a/20909875/535632 )。根据最后的答案,似乎有些应用程序(特别是Spotify)通过音乐播放器路由他们的音乐来使用搜索栏。

Based on some of the other questions and documentation the seek bar is only accessible via Apple's own apps (https://stackoverflow.com/a/20142141/535632, https://stackoverflow.com/a/20909875/535632). According to that last answer, it appears some apps (notably Spotify) route their music through the music player to utilize the seek bar.

这篇关于在锁定屏幕上设置和访问iOS搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆