i need help, i have a VideoView and three button under this Videoview, there is a default URL that is set to the Videoview, what i want to achieve is when the user clicks button A, this should change the Videoview to the url which is set to the button the user clicks, the same goes for button B and C, each button clicked should change the view to the url attach to the button click. Presently with the approach am using freezes the current Videoview that is playing and it hangs there. Then I get an error saying below but it doesn't crash the app, it just hangs the Videoview currently showing
MediaPlayer(13338): Error (1,-2147483648) VideoView(13338): Error: 1,-2147483648
this is what am trying:-
vid = (VideoView) findViewById(R.id.videoview);
ImageView btnA = (ImageView) findViewById(R.id.low);
ImageView btnB = (ImageView) findViewById(R.id.high);
ImageView btnC = (ImageView) findViewById(R.id.audio);
vid.setVideoPath(--default URL Here---);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(vid);
vid.setMediaController(mediaController);
vid.requestFocus();
vid.start();
videoBuffering = new ProgressDialog(this);
videoBuffering.setMessage("Loading video data....");
videoBuffering.setIcon(R.drawable.ic_launcher);
videoBuffering.setTitle(R.string.app_name);
videoBuffering.setProgressStyle(ProgressDialog.STYLE_SPINNER);
videoBuffering.show();
vid.setOnErrorListener(new OnErrorListener () {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
Log.e(TAG, "Error playing video");
return true;
}
});
vid.setOnPreparedListener(new OnPreparedListener(){
@Override
public void onPrepared(MediaPlayer mp) {
videoBuffering.dismiss();
}
});
btnA.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
if (vid.isPlaying())
{
vid.suspend();
vid.setVideoPath("URL 1");
vid.start();
}
else{
vid.setVideoPath("URL 1");
vid.start();
}
}
});
btnB.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
if (vid.isPlaying())
{
vid.suspend();
vid.setVideoPath("URL 2");
vid.start();
}
else{
vid.setVideoPath("URL 2");
vid.start();
}
}
});
btnC.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
if (vid.isPlaying())
{
vid.suspend();
vid.setVideoPath("URL 3");
vid.start();
}
else{
vid.setVideoPath("URL 3");
vid.start();
}
}
});