我想使用ADB命令检查以终端为根的外部设备中是否正在播放音频/视频。如果有提及,我找不到任何ADB命令
我尝试过adb shell dumpsys media.player
我想要一个命令来指定视频是否正在运行
答案 0 :(得分:0)
我认为没有直接的命令可以做到这一点。但是您可以使用
查询所有正在运行的服务adb shell service list | grep 'media.player'
答案 1 :(得分:0)
要打印出MediaPlayer状态:
adb shell dumpsys audio
但这将显示整个设备的输出。像这样:
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
您可以使用它来获取应用程序的PID,然后检查MediaPlayer的状态:
adb shell pidof -s your.package.name