Is there an ADB command to check a media is playing or not

时光怂恿深爱的人放手 提交于 2021-02-11 15:18:16

问题


I want to check whether the Audio/Video is playing in my external device which is rooted in terminal using ADB command.I am not able to find any ADB commands if available mention that

I have tried adb shell dumpsys media.player

i want a command to specify if video is running or not


回答1:


I think there is no direct command to do that. But you can query all the running service using

adb shell service list | grep 'media.player'



回答2:


To print out the MediaPlayer states:

adb shell dumpsys audio

But this will show the output of entire device. Like so:

06-25 14:11:02:226 new player piid:1343 uid/pid:10080/26372 type:android.media.MediaPlayer attr:AudioAttributes: usage=USAGE_UNKNOWN content=CONTENT_TYPE_UNKNOWN flags=0x0 tags= bundle=null
06-25 14:11:02:249 player piid:1343 state:started
06-25 14:35:13:911 releasing player piid:1343
06-25 14:35:20:570 new player piid:1351 uid/pid:10080/29715 type:android.media.MediaPlayer attr:AudioAttributes: usage=USAGE_UNKNOWN content=CONTENT_TYPE_UNKNOWN flags=0x0 tags= bundle=null
06-25 14:35:20:598 player piid:1351 state:started
06-25 14:35:29:720 releasing player piid:1351
06-25 14:36:34:263 new player piid:1359 uid/pid:10080/29715 type:android.media.MediaPlayer attr:AudioAttributes: usage=USAGE_UNKNOWN content=CONTENT_TYPE_UNKNOWN flags=0x0 tags= bundle=null
06-25 14:36:34:304 player piid:1359 state:started

You can use this to get the PID of your app and then check the state of the MediaPlayer:

adb shell pidof -s your.package.name


来源:https://stackoverflow.com/questions/54241551/is-there-an-adb-command-to-check-a-media-is-playing-or-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!