【问题标题】:VideoView Error on BeagleBoard ICSBeagleBoard ICS 上的 VideoView 错误
【发布时间】:2012-07-16 07:37:36
【问题描述】:

我正在尝试使用 VideoView 一个接一个地播放多个视频(.mp4 格式)。它在带有 ICS 的 Android 平板电脑上运行良好,但是当我在 BeagleBoard 上运行它时出现错误“抱歉,无法播放此视频”错误Android ICS 的硬件。logcat 错误如下:

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);  } }

任何建议都会有所帮助。

【问题讨论】:

  • 你能贴出完整的代码让大家看清楚吗??
  • 写videoView.reset();而不是 videoView.stopPlayback();在你的代码中
  • 我添加了更多代码。请检查。
  • onCompletion 你在开始意图之前调用了finish()??
  • 没有“videoview.reset()”这样的方法;

标签: java android android-4.0-ice-cream-sandwich beagleboard


【解决方案1】:

试试这个:

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

OnCompletionListener 写这个:

OnCompletionListener completionListener=new OnCompletionListener() {

        public void onCompletion(MediaPlayer mp) {
            mp.stop();
            Intent intent = new Intent(YourActivity.this, NewActivity.class);
            startActivity(intent);
        }
    };

【讨论】:

  • 我尝试了你上面的代码,它在 ICS 平板电脑上运行良好,但在 BeagleBoard 上运行良好。我仍然遇到同样的错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多