/**
* 调用系统视频录制
*
* @time 下午05:15:41
* @author retacn yue
* @Email zhenhuayue@sina.com
*/
@SuppressWarnings("unused")
public class VideoCaptureActivity extends Activity implements OnClickListener {
private static final int VIDEO_CAPTURE = 0;
Button btn_play, btn_capture;
VideoView videoView;
private Uri videoFileUri;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.capture_video);
findView();
}
/**
* 实例化控件
*/
private void findView() {
btn_capture = (Button) this.findViewById(R.id.btn_start_capture);
btn_capture.setOnClickListener(this);
btn_play = (Button) this.findViewById(R.id.btn_play_capture_video);
btn_play.setOnClickListener(this);
btn_play.setEnabled(false);
videoView = (VideoView) this.findViewById(R.id.vdv_capture_video);
}
@Override
public void onClick(View v) {
if (v == btn_capture) {
Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(intent, VIDEO_CAPTURE);
} else if (v == btn_play) {
videoView.setVideoURI(videoFileUri);
videoView.start();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
videoFileUri = data.getData();
btn_play.setEnabled(true);
}
}
}
android 多媒体部分学习笔记十五-----视频录制
最新推荐文章于 2024-09-03 17:19:15 发布