Android视频无法播放通过网址上传到服务的录制视频

时间:2015-05-21 11:23:59

标签: android

 This is my code please tell  where am i doing wrong,
    I am receiving the uri from service and i have implemented the following code which is not running the video properly,but some videos are playing great and some gets played only when it is buffered completely

已加载到SD卡中的服务的视频是playig而不会停止。

但我录制并上传到服务的视频只有在完全缓冲后播放

在更糟糕的情况下,这些视频也很重要 请求告诉我哪里出错了

                progressDialog = new ProgressDialog(MoviePlayer.this);

                // set a title for the progress bar

                progressDialog.setTitle("Please Wait");

                // set a message for the progress bar

                progressDialog.setMessage("Loading...");

                // set the progress bar not cancelable on users' touch

                progressDialog.setCancelable(false);

                // show the progress bar

                progressDialog.show();

                try {

                    // set the media controller in the VideoView

                    myVideoView.setMediaController(mediaControls);

                    // set the uri of the video to be played

这是我在视频中获取网址并尝试播放的地方

                    myVideoView.setVideoURI(Uri.parse(VideoPath));
                    if (ConnectApi.printBool) {
                        System.out.println("VideoPath VideoPath" + VideoPath);
                    }

                } catch (Exception e) {

                    e.printStackTrace();

                }

                myVideoView.requestFocus();

                // we also set an setOnPreparedListener in order to know when the video
                // file is ready for playback
        This is where my audio get recorded completely

                myVideoView.setOnPreparedListener(new OnPreparedListener() {

                    public void onPrepared(MediaPlayer mediaPlayer) {

                        // close the progress bar and play the video

                        if (progressDialog != null) {
                            progressDialog.dismiss();
                            progressDialog = null;
                        }
                        // if we have a position on savedInstanceState, the video
                        // playback should start from here

                        myVideoView.seekTo(position);

                        if (position == 0) {

                            myVideoView.start();

                        } else {

                            // if we come from a resumed activity, video playback will
                            // be paused

                            myVideoView.pause();

                        }

                    }

                });
                myVideoView.setOnErrorListener(new OnErrorListener() {

                    @Override
                    public boolean onError(MediaPlayer mp, int what, int extra) {
                        // TODO Auto-generated method stub
                        return false;
                    }
                });
            }
        enter code here

        }

0 个答案:

没有答案