Good afternoon / morning! Hoping someone can help me with the little problem I am having. I play a remote .mp3 file using VideoView and a custom MediaController .
My MediaController is as follows:
public class MyMediaController extends MediaController { public MyMediaController(Context context) { super(context); }
}
And my code to attach it to my VideoView is as follows:
VideoView videoView = (VideoView) findViewById(R.id.VideoView); // Use our own media controller, which inherits from the standard one. Do this to keep // playback controls from disappearing. mediaController = new MyMediaController(this); mediaController.setAnchorView(videoView); Uri video = Uri.parse(URL); videoView.setMediaController(mediaController); videoView.setVideoURI(video); // Set a handler that will show the playback controls as soon as audio starts. videoView.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer arg0) { mediaController.show(); } }); videoView.start();
The problem I am facing is that when the .mp3 file starts playing, the control panel at the bottom has a “Play” button that displays (ie a triangle) instead of the “Pause” button (two parallel bars), although the sound is already reproduced. Does anyone know how to fix this?
EDIT 1:
I would also be interested in any other solutions for playing remote .mp3. The only requirements that I have is that the user can pause / play audio, and also see what the name of the audio file (header) is.
Thanks!
source share