android 中可以检测视频播放事件吗?
我想检测“视频正在播放”“视频已暂停”“视频播放已停止”等事件。
我不想写我自己的播放器。我只需要记录已调用的默认视频播放器的事件。我可以为 Android 中的默认播放器注册任何广播事件吗?
I want to detect events like "Video is playing" "Video has been paused" "Video Play has stopped".
I do not want to write my own player. I just need to log the events of the default video player that has been called. Is there any broadcast event that I can register to for the default player in android?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
除非您有自定义 rom,否则这是不可能的。
It is not possible unless you have a custom rom.
我不确定你到底需要什么,但答案是“也许”。
具体来说:
可以检测是否活动被暂停? (线程问题)
问:是否可以检测活动是否暂停?
答:是的,请参阅此处。只需重写 Activity 中的 onPause 就可以了
。可能就这么简单。
或者,在此处查看媒体播放器状态图和可用方法:
http:// developer.android.com/reference/android/media/MediaPlayer.html
I'm not sure exactly what you need, but the answer is "maybe".
Specifically:
It is possible to detect if an activity was paused? (thread problem)
Q: It is possible to detect if an activity was paused?
A: Yes see here. Just override the onPause in your activity
It might be as simple as that.
Alternatively, look at the Media Player state diagram and available methods here:
http://developer.android.com/reference/android/media/MediaPlayer.html
有可能绑定到 Android 的音乐播放器服务。 此处对此进行了描述。您可以获取当前的曲目和资料,但我不确定您是否可以注册活动。如果您了解更多信息,请告诉我们。
There is a possibility to bnd to Android's music player service. It is described here. You can obtain the current track and stuff, but I'm not sure whether you can register to events. Let us know if you find out more.