问题
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