Debug|如何通过adb shell am播放音视频文件
如何通過am 啓動一個電話:
am start -a android.intent.action.CALL -d tel:10010
如何使用alsa_aplay 播放一個本地raw文件.
alsa_aplay -C-Dhw:2,0 -r 8000 -c 1 -f S16 -t raw /d.raw
一、如果想通过adb shell播放一个mp3文件,可以通过以下的命令完成:
(1)通过am 播放音频文件
mp3 file located at /storage/sdcard0/Music/hello.mp3
【Debug|如何通过adb shell am播放音视频文件】adb shell am start -a "android.intent.action.VIEW" -t "audio/mp3" -d "file:///storage/sdcard0/Music/hello.mp3"
(2)通过am 播放视频文件:
For video playback, you can try this:
adb shell am start -a android.intent.action.VIEW -d"file:///mnt/sdcard/DCIM/Camera/test.3gp" -t "video/*"
gives you a prompt of all capable players that can play this file.
adb shell am start -a android.intent.action.VIEW -d "file:///mnt/sdcard/DCIM/Camera/test.3gp" -t "video/*" -n "com.alensw.PicFolder/.PlayerActivity"
二、也可以通过编译一个可执行文件来在终端运行,以下是一个例子:
http://stackoverflow.com/questions/26298306/android-adb-shell-command-to-play-sound-from-the-command-line/26329605#26329605
Android adb shell command to play sound from the command line
文章图片
文章图片
up vote0down vote favorite | I have a set of rooted android devices I can access through adb over tcp/ip.I am trying to identify a specific one by playing a sound from the command line (one of the .ogg files from /system/media/audio). I know I could probably build an app for this but it feels like an overkill to use an APK, and I'm hoping there is a more native way. I already know how to start intents from the command line. Things I have tried :
androidadb
|
||||||||||||||||
|
up vote1down voteaccepted | After some trial and error, I will answer what is now working for me. Based on other threads, I found the following java code to be the bare minimum to play some sound through the speaker. The MediaPlayer class seems the only one that will play with no user interaction, as others need a real activity context...
(actual working example is here) This must then be compiled as a dex file, linked to android.jar, and can finally be run from the adb shell command line using app_process (not dalvikvm) :
It is not the one-liner I was hoping for but does what I needed... |
推荐阅读
- 考研英语阅读终极解决方案——阅读理解如何巧拿高分
- 如何寻找情感问答App的分析切入点
- mybatisplus如何在xml的连表查询中使用queryWrapper
- MybatisPlus使用queryWrapper如何实现复杂查询
- gitlab|gitlab 通过备份还原 admin/runner 500 Internal Server Error
- 如何在Mac中的文件选择框中打开系统隐藏文件夹
- 漫画初学者如何学习漫画背景的透视画法(这篇教程请收藏好了!)
- java中如何实现重建二叉树
- Linux下面如何查看tomcat已经使用多少线程
- thinkphp|thinkphp 3.2 如何调用第三方类库