0

I am trying to play multiple videos(.mp4 format) one after the other using VideoView.It works fine on Android Tablets with ICS but it gives the error "Sorry this video cannot be played" error when I run it on BeagleBoard hardware with Android ICS.The logcat errors are as follows:

MediaPlayer(3151):error(1,-110).
MediaPlayer(3151):error(1,-110).
VideoView(3151):error(1,-110).

> public class PlayVideoActivity extends Activity implements
> OnCompletionListener {
> 
>   @Override   protected void onCreate(Bundle savedInstanceState) {
>       super.onCreate(savedInstanceState);         PowerManager pm =
> (PowerManager) getSystemService(Context.POWER_SERVICE);       mWakeLock =
> pm.newWakeLock(PowerManager.FULL_WAKE_LOCK |
> PowerManager.ACQUIRE_CAUSES_WAKEUP, TAG);         mWakeLock.acquire();
>               setContentView(R.layout.playvideo);         videoView = (VideoView) findViewById(R.id.videoView);  
>       videoView.setOnCompletionListener(this);
>       
>       mVideoLocalPathArrayList.add("/mnt/sdcard/downloads/mediabox/film.mp4");
>       mVideoLocalPathArrayList.add("/mnt/sdcard/downloads/mediabox/et.mp4");
>       mVideoLocalPathArrayList.add("/mnt/sdcard/downloads/mediabox/interview.mp4");
>               playListVideo();    }
> 
>   private void playListVideo() {      try {
>               if (Util.CURRENT_VIDEO > 2) {
>                   Util.CURRENT_VIDEO = 0;
>               }
>               playVideo(mVideoLocalPathArrayList.get(Util.CURRENT_VIDEO ));       } catch (Exception e) {     }       private void playVideo(String string) {
>       mediaController = new MediaController(this);
>       mediaController.setMediaPlayer(videoView);
>       videoView.setMediaController(mediaController);
>       //videoView.stopPlayback();
>       videoView.setVideoURI(Uri.parse(string));
>       videoView.requestFocus();
>       videoView.setMediaController(mediaController);      videoView.start();
>   }
> 
>   @Override   public void onCompletion(MediaPlayer arg0) {        finish();
>       Util.CURRENT_VIDEO++;       Intent intent = new Intent(this,
> PlayVideoActivity.class);         startActivity(intent);  } }

Any advice would be helpful.

Raj Trivedi
  • 557
  • 7
  • 18

1 Answers1

0

Try this:

        videoView.setVideoURI(uri);
        videoView.start();
        videoView.setOnCompletionListener(completionListener);

OnCompletionListener write this:

OnCompletionListener completionListener=new OnCompletionListener() {

        public void onCompletion(MediaPlayer mp) {
            mp.stop();
            Intent intent = new Intent(YourActivity.this, NewActivity.class);
            startActivity(intent);
        }
    };
AkashG
  • 7,868
  • 3
  • 28
  • 43
  • I tried the above code of yours it works fine on ICS tablets but NOT on BeagleBoard.I still get the same errors. – Raj Trivedi Jul 16 '12 at 10:35