当前位置:操作系统 > 安卓/Android >>

android视频录制

 

MediaRecorder recorder = new MediaRecorder

 

recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); //从照相机采集视频

 

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);

 

recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);

 

recorder.setVideoSize(320, 240);

 

recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);//设置视频编码方式

 

recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

 

File videoFile = new File(Environment.getExternalStorageDirectory(),System.currentTimeMillis() + ".3gp");

 

recorder.setOutputFile(videoFile.getAbsolutePath());

 

recorder.setPreviewDisplay(su易做图ceView.getHolder().getSu易做图ce());

 

recorder.prepare();//预期准备

 

recorder.start();//开始刻录

 

 

 

recorder.stop();

 

摘自junjieking的专栏

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,