问题描述
我试图用RemoteControlClient类,以支持锁屏播放器,我的应用程序。一个问题是,设置交通控制标志好像他们根本无法正常工作。
I'm trying to use the RemoteControlClient class to support the lock screen player with my app. One issue is that setting the transport control flags seems like they don't work properly.
例如我想只显示一个播放/停止图标没有preV /下一:
For example I'm trying to just show a play/stop icon no prev/next:
mRemoteControlClient.setTransportControlFlags(
RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE |
RemoteControlClient.FLAG_KEY_MEDIA_STOP);
这显示了previous图标和暂停图标!为什么呢?
This shows a previous icon and pause icon! Why?
为了让事情变得更糟时,pressing停止/播放键,你只能获得键code_MEDIA_PLAY_PAUSE
时,你应该得到 KEY code_MEDIA_STOP
或键code_MEDIA_PLAY
。
To make things even worse when pressing the stop/play button you only receive KEYCODE_MEDIA_PLAY_PAUSE
when you should be getting KEYCODE_MEDIA_STOP
or KEYCODE_MEDIA_PLAY
.
这是在Android一边无奈的扶贫开发,如果我发现我是正确的事情了。
This is frustrating poor development on Android side if I find out I'm doing this correctly.
推荐答案
使用的FLAG_KEY_MEDIA_PLAY_PAUSE
Use the FLAG_KEY_MEDIA_PLAY_PAUSE
<$c$c>oRemoteControlClient.setTransportControlFlags(RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE);$c$c>
和骗RemoteControlClient; - )
And lie to the RemoteControlClient ;-)
告诉他,流缓冲,它会显示停止按钮!
Tell him the stream is buffering and it will show the stop button!
oRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_BUFFERING);
干杯
这篇关于的Android 4.x的RemoteControlClient.setTransportControlFlags()不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!