4

I just have tried the old method of start to play a .mp3 file with adb command.

adb shell am start -n com.google.android.music/com.android.music.MediaPlaybackActivity -d /sdcard/Music/abc.mp3

But currently it does not work. Could any one help to check if there are any updated ways to do so?

Saif Ali Khan
  • 818
  • 3
  • 9
  • 34
Michael.Zhou
  • 169
  • 1
  • 2
  • 7
  • And I also have tried `adb shell am start -n com.google.android.music/com.android.music.activitymanagement.TopLevelActivity -d /sdcard/Music/abc.mp3` since I found the sub-activity name has been changed. but could only start the activity, not able to play. – Michael.Zhou Aug 01 '14 at 15:50
  • I also tried `adb shell am start -a android.intent.action.View -d "file:///sdcard/Music/abc.mp3" -n "com.google.android.music/com.android.music.activitymanagement.TopLevelActivity"`, still does not works. – Michael.Zhou Aug 01 '14 at 16:35

2 Answers2

9

Issue resolved by using command such as:

(file path: /storage/sdcard0/test.wav)

adb shell am start -a android.intent.action.VIEW -d file:///storage/sdcard0/test.wav -t audio/wav

(file path: /storage/emulated/0/test.wav)

adb shell am start -a android.intent.action.VIEW -d file:///storage/emulated/0/test.wav -t audio/wav
0x8BADF00D
  • 7,138
  • 2
  • 41
  • 34
Michael.Zhou
  • 169
  • 1
  • 2
  • 7
4

Start Play:

adb shell am start -a android.intent.action.VIEW -d file:///storage/emulated/0/test.wav  -t audio/wav

To Close the Player:

adb shell input keyevent 4

To Stop the Player:

adb shell input keyevent 127

Pause/resume:

adb shell input keyevent 85
Lovis
  • 9,513
  • 5
  • 31
  • 47
subh2020
  • 51
  • 6