0

I have an MP3 audio file that I want to play from my Android app. I am using MediaController and VideoView like the answer to question 2961749. I get the error "Sorry this video cannot be played." But if I copy the file to /Music on my sd card, I can play it with the Music player app on Android. I've also tried just using MediaPlayer and it has a similar error.

Any ideas why this would be? And, an anyone tell me what I need to do to play the audio?

Here's my code:

setContentView(R.layout.reading_layout);
topicGraphic = (ImageView) findViewById(R.id.topic_graphic);
videoView = (VideoView) findViewById(R.id.video_view);

Uri uri = Uri.parse("/sdcard/audio/mainidea.mp3");
mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setVideoURI(uri);
videoView.start();
Community
  • 1
  • 1
John in MD
  • 2,141
  • 5
  • 25
  • 36

1 Answers1

0

Hey I figured it out. I had mounted my SD card to copy audio files from my PC. This meant my app could not access the SD card. When I unmounted the SD card it worked. It would have been nice if the error message told me this but I'm happy to have audio playing.

John in MD
  • 2,141
  • 5
  • 25
  • 36