无法在客户端打开文件,尝试服务器端

时间:2016-12-20 16:48:17

标签: android video mp4 android-videoview

使用视频观看我试过播放mp4视频。

目前此链接有效https://archive.org/download/ksnn_compilation_master_the_internet/ksnn_compilation_master_the_internet_512kb.mp4

然而,当我尝试这些时,他们不会玩

  1. http://vis-insight.com/video/SampleVideo_1280x720_1mb%20(1).mp4
  2. http://vis-insight.com/video/m-1.3.6.1.4.1.5962.99.1.3591259986.1562889010.1377980827474.2.0.mp4
  3. 我一直在客户端获取无法打开文件,尝试服务器端和错误(1,-38)

    我的代码如下。

    pDialog = new ProgressDialog(getActivity());
    // Set progressbar title
    pDialog.setTitle("Android Video Streaming Tutorial");
    // Set progressbar message
    pDialog.setMessage("Buffering...");
    pDialog.setIndeterminate(false);
    pDialog.setCancelable(false);
    // Show progressbar
    pDialog.show();
    
    try {
        // Start the MediaController
        MediaController mediacontroller = new MediaController(
                getActivity());
        mediacontroller.setAnchorView(mVideoView);
        // Get the URL from String VideoURL
        //Uri video = Uri.parse("https://staging.vitalengine.com/dicom-cstore/dicom-media?media=ABEL_3/1.3.6.1.4.1.5962.99.1.3591259986.1562889010.1377980827474.3.0/1.3.6.1.4.1.5962.99.1.3591259986.1562889010.1377980827474.4.0/m-1.3.6.1.4.1.5962.99.1.3591259986.1562889010.1377980827474.2.0.mp4");
        Uri video = Uri.parse("https://archive.org/download/ksnn_compilation_master_the_internet/ksnn_compilation_master_the_internet_512kb.mp4");
        //Uri video = Uri.parse("http://vis-insight.com/video/SampleVideo_1280x720_1mb%20(1).mp4");
        mVideoView.setMediaController(mediacontroller);
        mVideoView.setVideoURI(video);
    
    } catch (Exception e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
    }
    
    mVideoView.requestFocus();
    mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        // Close the progress bar and play the video
        public void onPrepared(MediaPlayer mp) {
            pDialog.dismiss();
            mVideoView.start();
        }
    });
    

0 个答案:

没有答案