2017-08-29 221 views
1

我只需要幫助我的代碼,我正在使用Android Studio。一切正常,但錄製的視頻不會顯示在我的佈局viewVideo。錄製的視頻不會顯示在視頻上視頻

下面的代碼:

public class MainActivity extends AppCompatActivity { 
 

 
    static final int REQUEST_VIDEO_CAPTURE = 1; 
 
    VideoView resultvideo; 
 

 
    @Override 
 
    protected void onCreate(Bundle savedInstanceState) { 
 
     super.onCreate(savedInstanceState); 
 
     setContentView(R.layout.activity_main); 
 

 
     Button click = (Button)findViewById(R.id.videorec); 
 
     resultvideo = (VideoView)findViewById(R.id.videoView); 
 
    } 
 

 
    public void dispatchTakeVideoIntent(View v) { 
 
     Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); 
 
     if (takeVideoIntent.resolveActivity(getPackageManager()) != null) { 
 
      startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE); 
 
     } 
 
    } 
 

 
    @Override 
 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
 
     if (requestCode == REQUEST_VIDEO_CAPTURE && resultCode == RESULT_OK) { 
 
      Uri videoUri = data.getData(); 
 
      resultvideo.setVideoURI(videoUri); 
 
     } 
 
    } 
 
}

回答

0
 Uri videoUri = data.getData(); 
     resultvideo.setVideoURI(videoUri); 
     // start call missing 
     resultvideo.start(); 
+0

能否請您給予好評的。 – Sush

+0

感謝您的反饋!記錄下名聲低於15的人的投票記錄,但不要更改公開顯示的帖子分數。 @Sush – Renzo

+0

哦,明白了,無論如何感謝您的接受。 – Sush