tags:

views:

59

answers:

1

Hi,

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();
A: 

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
Feel free to mark your own answer as accepted, so people will know the question has been answered.
Brian Campbell
But why do you use video view?
Konstantin Burov
I tried to mark it answered but StackOverflow makes you wait 48 hours.
John in MD
I was just trying to get it to play by using another example, which used VideoView.
John in MD