是否可以有类似于以下对视频执行相同操作的代码?
if (resultCode == Activity.RESULT_CANCELED) {
// camera mode was canceled.
} else if (resultCode == Activity.RESULT_OK) {
// Took a picture, use the downsized camera image provided by default
Bitmap cameraPic = (Bitmap) data.getExtras().get("data");
if (cameraPic != null) {
try {
savePic(cameraPic);
} catch (Exception e) {
Log.e(DEBUG_TAG, "saveAvatar() with camera image failed.", e);
}
}
我想要做的是能够使用相机意图拍摄视频并将该视频或该视频的副本保存到我的特定目录。这是我必须采取剪辑的代码:
private void initTakeClip(){
Button takeClipButton = (Button) findViewById(R.id.takeClip);
takeClipButton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
String strVideoPrompt = "Take your Video to add to your timeline!";
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(Intent.createChooser(cameraIntent, strVideoPrompt), TAKE_CLIP_REQUEST);
}
});
}
我只是不知道如何去获取刚刚拍摄的特定视频,然后将其复制到我的 sd/appname/project_name/ 目录中。
将已从内存中的剪辑添加到我的目录时获取名称/文件位置的情况也是如此:
private void initAddClip(){
Button addClipButton = (Button) findViewById(R.id.addClip);
addClipButton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
String strAvatarPrompt = "Choose a picture to use as your avatar!";
Intent pickVideo = new Intent(Intent.ACTION_PICK);
pickVideo.setType("video/*");
startActivityForResult(Intent.createChooser(pickVideo, strAvatarPrompt), ADD_CLIP_REQUEST);
}
});
}
任何/所有帮助将不胜感激。