List of usage examples for android.provider MediaStore ACTION_VIDEO_CAPTURE
String ACTION_VIDEO_CAPTURE
To view the source code for android.provider MediaStore ACTION_VIDEO_CAPTURE.
Click Source Link
From source file:info.guardianproject.iocipher.camera.VideoCameraActivity.java
@Override public void onCreate(Bundle savedInstanceState) { getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); super.onCreate(savedInstanceState); mFileBasePath = getIntent().getStringExtra("basepath"); isRequest = getIntent().getAction() != null && getIntent().getAction().equals(MediaStore.ACTION_VIDEO_CAPTURE); mResultList = new ArrayList<String>(); }
From source file:com.univpm.s1055802.faceplusplustester.Detect.AcquireVideo.java
/** * Richiama la fotocamera, acquisisce il video e lo salva in un file * @return il file salvato/*w ww . j av a 2 s . co m*/ */ private void Acquire() { Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); // Ensure that there's a camera activity to handle the intent videoFile = null; if (takeVideoIntent.resolveActivity(getPackageManager()) != null) { // Create the File where the photo should go try { videoFile = createVideoFile(); } catch (IOException ex) { // Error occurred while creating the File Log.v("alert", "file error"); } // Continue only if the File was successfully created if (videoFile != null) { takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(videoFile)); takeVideoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(takeVideoIntent, REQUEST_TAKE_VIDEO); } } }
From source file:com.waz.zclient.pages.main.conversation.AssetIntentsManager.java
private void captureVideo(IntentType type) { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); pendingFileUri = getOutputMediaFileUri(IntentType.VIDEO); intent.putExtra(MediaStore.EXTRA_OUTPUT, pendingFileUri); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) { intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); }// ww w . ja v a 2 s.c om callback.openIntent(intent, type); }
From source file:org.opendatakit.survey.android.activities.MediaCaptureVideoActivity.java
@Override protected void onResume() { super.onResume(); if (afterResult) { // this occurs if we re-orient the phone during the save-recording // action returnResult();//from w ww .j a v a 2 s . c o m } else if (!hasLaunched && !afterResult) { Intent i = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); // to make the name unique... File f = ODKFileUtils.getAsFile(appName, (uriFragmentToMedia == null ? uriFragmentNewFileBase : uriFragmentToMedia)); int idx = f.getName().lastIndexOf('.'); if (idx == -1) { i.putExtra(Video.Media.DISPLAY_NAME, f.getName()); } else { i.putExtra(Video.Media.DISPLAY_NAME, f.getName().substring(0, idx)); } // Need to have this ugly code to account for // a bug in the Nexus 7 on 4.3 not returning the mediaUri in the data // of the intent - using the MediaStore.EXTRA_OUTPUT to get the data // Have it saving to an intermediate location instead of final destination // to allow the current location to catch issues with the intermediate file WebLogger.getLogger(appName).i(t, "The build of this device is " + android.os.Build.MODEL); if (NEXUS7.equals(android.os.Build.MODEL) && Build.VERSION.SDK_INT == 18) { nexus7Uri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO); i.putExtra(MediaStore.EXTRA_OUTPUT, nexus7Uri); } try { hasLaunched = true; startActivityForResult(i, ACTION_CODE); } catch (ActivityNotFoundException e) { String err = getString(R.string.activity_not_found, MediaStore.ACTION_VIDEO_CAPTURE); WebLogger.getLogger(appName).e(t, err); Toast.makeText(this, err, Toast.LENGTH_SHORT).show(); setResult(Activity.RESULT_CANCELED); finish(); } } }
From source file:com.albedinsky.android.support.intent.VideoIntent.java
/** * Creates a new instance of Intent with {@link MediaStore#ACTION_VIDEO_CAPTURE} * that can be used to launch a camera app to capture a single video. * * @param outputUri If not {@code null}, it will be attached to intent as {@link MediaStore#EXTRA_OUTPUT}, * so when the result is received in for example {@link Activity#onActivityResult(int, int, Intent)}, * the <var>outputUri</var> will address to a file which contains the currently * captured video./* w ww . ja v a 2 s . co m*/ * @return New camera intent instance. * @see #createCameraIntent(File) */ @NonNull public static Intent createCameraIntent(@Nullable Uri outputUri) { final Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); if (outputUri != null) { intent.putExtra(MediaStore.EXTRA_OUTPUT, outputUri); } return intent; }
From source file:com.liferay.mobile.screens.viewsets.defaultviews.ddl.form.fields.DDLDocumentFieldView.java
protected AlertDialog createOriginDialog() { Activity activity = LiferayScreensContext.getActivityFromContext(getContext()); AlertDialog.Builder builder = new AlertDialog.Builder(activity); LayoutInflater factory = LayoutInflater.from(activity); final View customDialogView = factory.inflate(R.layout.ddlfield_document_chose_option_default, null); View takeVideoButton = customDialogView.findViewById(R.id.liferay_dialog_take_video_form); RxPermissions rxPermissions = new RxPermissions(activity); RxView.clicks(takeVideoButton)// w w w . j a va 2s. c om .compose(rxPermissions.ensure(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE)) .subscribe(launchCamera(MediaStore.ACTION_VIDEO_CAPTURE)); View takePhotoButton = customDialogView.findViewById(R.id.liferay_dialog_take_photo_form); RxView.clicks(takePhotoButton) .compose(rxPermissions.ensure(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE)) .subscribe(launchCamera(MediaStore.ACTION_IMAGE_CAPTURE)); final View selectFileButton = customDialogView.findViewById(R.id.liferay_dialog_select_file_form); RxView.clicks(selectFileButton).compose(rxPermissions.ensure(Manifest.permission.WRITE_EXTERNAL_STORAGE)) .subscribe(chooseFile(selectFileButton)); builder.setView(customDialogView); return builder.create(); }
From source file:com.kbeanie.imagechooser.api.VideoChooserManager.java
private String captureVideoCurrent() throws ChooserException { checkDirectory();/*from w w w .ja v a 2 s .c om*/ try { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); filePathOriginal = buildFilePathOriginal(foldername, "mp4"); intent.putExtra(MediaStore.EXTRA_OUTPUT, buildCaptureUri(filePathOriginal)); if (extras != null) { intent.putExtras(extras); } startActivity(intent); } catch (ActivityNotFoundException e) { throw new ChooserException(e); } return filePathOriginal; }
From source file:com.amytech.android.library.views.imagechooser.api.VideoChooserManager.java
private String captureVideoCurrent() throws Exception { checkDirectory();//from w w w .j av a 2 s. c o m try { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); filePathOriginal = FileUtils.getDirectory(foldername) + File.separator + Calendar.getInstance().getTimeInMillis() + ".mp4"; intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(filePathOriginal))); if (extras != null) { intent.putExtras(extras); } startActivity(intent); } catch (ActivityNotFoundException e) { throw new Exception("Activity not found"); } return filePathOriginal; }
From source file:com.cars.manager.utils.imageChooser.api.VideoChooserManager.java
private String captureVideoCurrent() throws Exception { checkDirectory();//from w w w . ja va 2s. co m try { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); filePathOriginal = FileUtils.getDirectory(foldername) + File.separator + Calendar.getInstance().getTimeInMillis() + ".mp4"; intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(filePathOriginal))); startActivity(intent); } catch (ActivityNotFoundException e) { throw new Exception("Activity not found"); } return filePathOriginal; }
From source file:org.opendatakit.survey.activities.MediaCaptureVideoActivity.java
@Override protected void onResume() { super.onResume(); if (afterResult) { // this occurs if we re-orient the phone during the save-recording // action returnResult();/* w w w. j a v a2 s . co m*/ } else if (!hasLaunched && !afterResult) { Intent i = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); // to make the name unique... File f = ODKFileUtils.getRowpathFile(appName, tableId, instanceId, (uriFragmentToMedia == null ? uriFragmentNewFileBase : uriFragmentToMedia)); int idx = f.getName().lastIndexOf('.'); if (idx == -1) { i.putExtra(Video.Media.DISPLAY_NAME, f.getName()); } else { i.putExtra(Video.Media.DISPLAY_NAME, f.getName().substring(0, idx)); } // Need to have this ugly code to account for // a bug in the Nexus 7 on 4.3 not returning the mediaUri in the data // of the intent - using the MediaStore.EXTRA_OUTPUT to get the data // Have it saving to an intermediate location instead of final destination // to allow the current location to catch issues with the intermediate file WebLogger.getLogger(appName).i(t, "The build of this device is " + android.os.Build.MODEL); if (NEXUS7.equals(android.os.Build.MODEL) && Build.VERSION.SDK_INT == 18) { nexus7Uri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO); i.putExtra(MediaStore.EXTRA_OUTPUT, nexus7Uri); } try { hasLaunched = true; startActivityForResult(i, ACTION_CODE); } catch (ActivityNotFoundException e) { String err = getString(R.string.activity_not_found, MediaStore.ACTION_VIDEO_CAPTURE); WebLogger.getLogger(appName).e(t, err); Toast.makeText(this, err, Toast.LENGTH_SHORT).show(); setResult(Activity.RESULT_CANCELED); finish(); } } }