Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start youtube video with adb?

Tags:

android

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"
like image 740
22332112 Avatar asked Dec 01 '25 11:12

22332112


2 Answers

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.

like image 93
flx Avatar answered Dec 04 '25 01:12

flx


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"
like image 35
J.Z Avatar answered Dec 03 '25 23:12

J.Z



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!