adb shell command for playing audio on Genymotion - android

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

Related

how to play video on vlc in a loop via adb shell

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?

open vlc on android from shell with arguments

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

How to play one audio file in android using adb command?

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.

Start youtube video with adb?

How do I open youtube application and start playing some video?
For example this video: http://www.youtube.com/watch?v=YRhFSWz_J3I
I tried to launch other applications successfully (for example playing local video on sdcard), but can't seem to find right way to start youtube (com.google.android.youtube).
Played local file
am start -n com.android.gallery3d/.app.MovieActivity -d "file:///sdcard/VideoTest/sample.mp4"
What about this:
adb shell am start -a android.intent.action.VIEW "http://www.youtube.com/watch?v=YRhFSWz_J3I"
I'm not sure, if -d is necessary for the URI, try this if it does not work:
adb shell am start -a android.intent.action.VIEW -d "http://www.youtube.com/watch?v=YRhFSWz_J3I"
It may open the Chooser activity on first run though.
you can find such a definition in the file AndroidManifest.xml of youtube play app:
<data android:scheme="vnd.youtube"/>
so, add "vnd.youtube:" to the head of youtube URL, for example:
"vnd.youtube:https://youtube.com/STH"
then run the adb command:
adb shell am start -a android.intent.action.VIEW -d "vnd.youtube:https://youtube.com/STH"

Launching movie playback via "am start"

I would like to launch a movie playback directly from the command line and the adb tools.
The way I do it, is with the instrumentation tool:
# am start -t video/mpeg -D /sdcard/Movies_3D/mymovie.mp4
But when I do that,
com.cooliris.media/.MovieView take the intent, doesn't crash, but "is waiting for the debugger to attach"
How to specify directly the Media Player? I cannot find the class name to call.
(uninstalling com.coloris is not an option)
Thanks,
Following works on Android ICS (4.0.3) version
am start -n com.android.gallery3d/.app.MovieActivity -d <URI>
For example, following command plays clip in /data/local/tests/ directory.
am start -n com.android.gallery3d/.app.MovieActivity -d file:////data//local//tests//big_buck_bunny_1080p_H264_AAC_25fps_7200K_short.MP4
This worked for me on Android 9.0
adb shell am start -a android.intent.action.VIEW -t video/mp4 -d file:///sdcard/DCIM/Camera/Video1.mp4

Categories

Resources