I am having one android target.
I have some audio file in mnt/sdcard0.
How can I play through adb command?
Music player application is already installed in the target.
use the following adb shell command:
adb shell am start -a android.intent.action.VIEW -d
file:///storage/sdcard0/test.wav -t audio/wav
There are two other command line programs which may work via a adb shell or even remotely using an ssh connection. Neither need an installed music player app.
adb shell stagefright -a -o file.mp3
and
adb shell tinyplay file.wav
(drop adb shell if not using an adb connection)
Note that tinyplay can only play stereo wav files. I found out about the stagefright command from a3nm's blog: Android from the command-line.
Related
I am trying to skip the chrome welcome screen when running tests. The problem is other solutions that I have found like this one don't seem to work anymore.
Commands used:
$ adb shell pm clear com.android.chrome
$ adb shell 'echo "chrome --disable-fre --no-default-browser-check --no-first-run" > /data/local/tmp/chrome-command-line'
$ adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
The solution for me was actually a combination of the question and this answer. The solution can also be found in another question/answer, though it's not entirely clear.
The following should work:
$ adb shell am set-debug-app --persistent com.android.chrome
$ adb shell 'echo "chrome --disable-fre --no-default-browser-check --no-first-run" > /data/local/tmp/chrome-command-line'
$ adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
Some notes:
In the Chromium project documentation, it's mentioned that for the command line file to be used, the user should
"Enable command line on non-rooted devices" in chrome://flags
Setting Chrome as the debug application replaces this requirement.
In older device versions, the command line file was expected in /data/local. This folder is no longer writable from adb shell in non-rooted devices, so /data/local/tmp should be used instead. This is documented in this bug
In the ChromeSwitches.java current source code, only --disable-fre still exists. The other flags might be required in older Chrome versions, but I didn't verify.
What is your OS version? It is working on Android 10. You can try the below commands:
$ adb shell pm clear com.android.chrome
$ adb shell am set-debug-app --persistent com.android.chrome
$ adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
I want to invest to test command my application through voice command something like "OK GOOGLE".
In addition to the method of using speakers to speak loudly, how can I say "OK Google" through ADB?
Thanks a lot
I was using Audio Loopback Dongle for call simulation. Hope it will works for commands too
wav generated by sudo apt-get install libttspico-utils
pico2wave -w google.wav "OK Google"
Move to device
adb push google.wav /sdcard/Download/
Playing wav by VLC:
adb shell am start -n org.videolan.vlc/.StartActivity -a android.intent.action.VIEW -d file:///sdcard/Download/google.wav -t 'audio/wav'
I'm trying to play a video on android via adb shell on vlc several times in a row.
When playing the video once the following command was sufficient:
adb shell am start -a android.intent.action.VIEW -d file:////storage/emulated/0/Download/bbb_sunflower_native_60fps_normal.mp4
But now I want to play the video several times/infinitely. Based on: How can I deliver parameters to a test function, that launched using adb shell am Instrumentation command , Start Android activity from command line with extra and https://wiki.videolan.org/VLC_command-line_help/ I tried:
adb shell am start -n org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity -e input-repeat 3 -a android.intent.action.VIEW -d file:////storage/emulated/0/Download/bbb_sunflower_native_60fps_normal.mp4
with various combinations including passing --input-repeat 3 and "input-repeat" 3 without success. E.g: the video would play but only once.
Also didn't help:
adb shell am start -n org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity -e PlaybackMode 1 -d file:////storage/emulated/0/Download/bbb_sunflower_native_60fps_normal.mp4
Does anyone know how it can be done?
I followed this guide and successfully compiled vlc for android.
I added my own codec "my_codec" and installed vlc with
./gradlew installVanillaX86Debug
Now I want to force vlc to use my code. on pc the command is
./vlc --codec my_codec,none sample.mp4
for android I tried both
adb shell am start -n org.videolan.vlc.debug/org.videolan.vlc.gui.video.VideoPlayerActivity -d file:///sdcard/sample.mp4 --es --codec my_codec,none
adb shell am start -n org.videolan.vlc.debug/org.videolan.vlc.gui.video.VideoPlayerActivity -d file:///sdcard/sample.mp4 --es codec my_codec,none
but my codec wasn't used.
more a hack than a real solution, but I eventually solved it by adding the code:
if(strcmp(capability,"video decoder") == 0){
name = "my_codec,none";
}
to the function vlc_module_load in the file vlc/src/modules/modules.c
I would like to running an app automatically using adb command. I know how can I send command like, swip, touch, and etc. How can I play a audio file to simulating voice?
I have test following but none of them work.
>adb shell tinyplay bird.wav
Unable to open file 'bird.wav'
and
>adb shell stagefright -a -o bird.wav
Unable to create data source.
I using Genymotion as an android device.
You can start an activity with file location provided.
Try this-
adb shell am start -a android.intent.action.VIEW -d file:///storage/sdcard0/sample.mp3 -t audio/mp3