视频视图在android中显示无法播放的对话框

时间:2017-09-08 12:55:00

标签: android android-videoview android-7.1-nougat

我正在列表中显示视频。一个接一个地播放视频之后它显示视频无法在Android中播放错误只剩下剩余的所有版本都正常工作。请帮我解决这个问题。以下是我在视频中播放视频的代码。

 videoview.setVideoURI(Uri.parse(streamInfo.video_streams.get(0).url));

                    viewHolder.large_videoview.seekTo(starttime * 1000);
                    viewHolder.large_videoview.start();


  videoview.setOnPreparedListener(new OnPreparedListener() {
                // Close the progress bar and play the video
                public void onPrepared(MediaPlayer mp) {
                    mMediaPlayer = mp;

                    mp.setOnInfoListener(new MediaPlayer.OnInfoListener() {
                        @Override
                        public boolean onInfo(MediaPlayer mp, int what, int extra) {
                            Log.e("large_videoview", "<><>onInfo");

                            if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START)
                                //Log.e("buffering starts", "buffering starts");
                                if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END)
                                    Log.e("buffering ends", "<><>buffering ends");
                            return false;
                        }
                    });
                }
            });

在我的日志猫中收到此错误

E / MediaPlayer:调用失败:错误状态0,mPlayer(0x7a30b0e0)

E / MediaPlayer:错误(1,-19)

E / MediaPlayer:错误(1,-1010)

1 个答案:

答案 0 :(得分:0)

你确定你这样做吗?

videoview.setOnPreparedListener(new OnPreparedListener() {

                public void onPrepared(MediaPlayer mp) {
                    videoview.start();
                }
            });

即等待VideoView做好准备&amp;一旦准备好了,你就打电话给start()吗?