code is as follows, you can call recording system, but cannot be saved to the specified folder, only on their own recording system folder, please help public void onClick (View v) {
//create a File to like, use the saved File after recording
Videoname=new Date (). GetTime () + "mp3";
The File outputVideo=new File (getActivity () getExternalFilesDir (" video "), videoname);
The Context Context=getContext ();
String path=context. GetExternalFilesDir (" video "). GetPath ();
If (Build) VERSION) SDK_INT & gt; 24)={
VideoUri=FileProvider. GetUriForFile (getActivity (), "com. Example. I_space. FileProvider", outputVideo);
} else {
VideoUri=Uri. FromFile (outputVideo);
}//machine process under phase sequence
Intent Intent=new Intent (MediaStore. Audio. Media. RECORD_SOUND_ACTION);
Intent. PutExtra (MediaStore. EXTRA_OUTPUT videoUri);
//intent. AddFlags (Inten. FLAG_GRANT_READ_URI_PERMISSION);
//intent. PutExtra (MediaStore EXTRA_VIDEO_QUALITY, 1);
StartActivityForResult (intent, TAKE_VIDEO);
}});
CodePudding user response:
A big help to solve the ah
CodePudding user response:
Use file copying, may
CodePudding user response:
Only after completion of the recording operation
@ Override
Protected void onActivityResult (int requestCode, int the resultCode, Intent Intent) {
Super. OnActivityResult (requestCode, the resultCode, intent);
If (the resultCode==RESULT_OK & amp; & RequestCode==TAKE_VIDEO & amp; & Intent. GetData ()!=null) {
String sourcePath=FileUtil. GetPath (this, intent. GetData ());//get absolute path
String videoname=new Date (). GetTime () + "mp3";
The File outputVideo=new File (getExternalFilesDir (" video "), videoname);
The File sourceF=new File (sourcePath);
Try {
Boolean success=sourceF. RenameTo (outputVideo);//rewriting to the new path
LogUtils. D + success (" success ");
} the catch (Exception e) {
Toast. MakeText (this, "Error:" + um participant etMessage (), Toast. LENGTH_LONG), show ();
}
}
}
CodePudding user response:
The