List of usage examples for android.provider MediaStore EXTRA_VIDEO_QUALITY
String EXTRA_VIDEO_QUALITY
To view the source code for android.provider MediaStore EXTRA_VIDEO_QUALITY.
Click Source Link
From source file:Main.java
public static void takeVideo(Activity ac) { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); ac.startActivityForResult(intent, TAKE_VIDEO); }
From source file:com.commonsware.android.videorecord.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { output = new File(new File(getFilesDir(), VIDEOS), FILENAME); if (output.exists()) { output.delete();/*from w w w .jav a 2 s . c o m*/ } else { output.getParentFile().mkdirs(); } } else { output = (File) savedInstanceState.getSerializable(EXTRA_FILENAME); } outputUri = FileProvider.getUriForFile(this, AUTHORITY, output); if (savedInstanceState == null) { Intent i = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); i.putExtra(MediaStore.EXTRA_OUTPUT, outputUri); i.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { i.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } else { List<ResolveInfo> resInfoList = getPackageManager().queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolveInfo : resInfoList) { String packageName = resolveInfo.activityInfo.packageName; grantUriPermission(packageName, outputUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } } startActivityForResult(i, REQUEST_ID); } }
From source file:org.alfresco.mobile.android.application.capture.VideoCapture.java
@Override public boolean captureData() { if (hasDevice()) { try {//from w w w . ja v a2 s.c om File folder = parentFolder; if (folder != null) { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); if (intent.resolveActivity(context.getPackageManager()) == null) { AlfrescoNotificationManager.getInstance(context).showAlertCrouton(parentActivity, context.getString(R.string.feature_disable)); return false; } payload = new File(folder.getPath(), createFilename("VID", "mp4")); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(payload)); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); // Represents a limit of 300Mb intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 314572800L); parentActivity.startActivityForResult(intent, getRequestCode()); } else { AlfrescoNotificationManager.getInstance(parentActivity) .showLongToast(parentActivity.getString(R.string.sdinaccessible)); } } catch (Exception e) { Log.d(TAG, Log.getStackTraceString(e)); return false; } return true; } else { return false; } }
From source file:com.diona.videoplugin.CameraUtil.java
/** * Method to get a video clip./*from w ww .ja va 2 s . c om*/ * * @param fragment * fragment instance that holds the callback method for the camera utility. */ public static void getVideoFromCamera(final Fragment fragment) { callingActivity = fragment; /*final SocialWorkerSharedPreferences preferences = SocialWorkerSharedPreferences.getInstance(); final Intent videoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); videoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, preferences.getVideoQuality()); final long videoSize = preferences.getVideoSize(); if (videoSize > 0) { videoIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, videoSize); } final int videoDuration = preferences.getVideoDuration(); if (videoDuration > 0) { videoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, videoDuration); } videoIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileCacheUtil.getOutputMediaFileUriForVideos()); callingActivity.startActivityForResult(videoIntent, VIDEO_REQUEST);*/ final Intent videoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); videoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); //final long videoSize = preferences.getVideoSize(); /* if (videoSize > 0) { videoIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 100); }*/ //final int videoDuration = preferences.getVideoDuration(); /*if (videoDuration > 0) { videoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 60); }*/ videoIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileCacheUtil.getOutputMediaFileUriForVideos()); callingActivity.startActivityForResult(videoIntent, VIDEO_REQUEST); }
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); }/*www . j a v a 2 s .com*/ callback.openIntent(intent, type); }
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//from w w w . j ava2s. 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.grottworkshop.gwswizardpager.ui.ImageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_page_image, container, false); ((TextView) rootView.findViewById(android.R.id.title)).setText(mPage.getTitle()); imageView = (ImageView) rootView.findViewById(R.id.imageView); String imageData = mPage.getData().getString(Page.SIMPLE_DATA_KEY); if (!TextUtils.isEmpty(imageData)) { Uri imageUri = Uri.parse(imageData); imageView.setImageURI(imageUri); } else {//ww w . j av a2 s .com imageView.setImageResource(R.drawable.ic_person); } imageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DialogFragment pickPhotoSourceDialog = new DialogFragment() { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setItems(R.array.image_photo_sources, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: // Gallery Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, GALLERY_REQUEST_CODE); break; default: // Camera mNewImageUri = getActivity().getContentResolver().insert( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new ContentValues()); Intent photoFromCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); photoFromCamera.putExtra(MediaStore.EXTRA_OUTPUT, mNewImageUri); photoFromCamera.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); startActivityForResult(photoFromCamera, CAMERA_REQUEST_CODE); break; } } }); return builder.create(); } }; pickPhotoSourceDialog.show(getFragmentManager(), "pickPhotoSourceDialog"); } }); return rootView; }
From source file:com.chute.android.photopickerplus.ui.activity.ServicesActivity.java
@Override public void recordVideo() { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); Uri uri = AppUtil.getTempVideoFile(); if (uri != null) { intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); }//from ww w . ja v a 2 s . c o m intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(intent, Constants.CAMERA_VIDEO_REQUEST); }
From source file:com.sandklef.coachapp.fragments.TrainingPhasesFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); int position = acmi.position; String fileName = LocalStorage.getInstance().getNewMediaDir() + "/tp-" + currentTPId + JsonSettings.SERVER_VIDEO_SUFFIX; Media m = Media.newInstructionVideo(fileName, currentTPId); currentTPId = null;/*w w w . j a v a 2 s. c o m*/ Uri uri = Uri.fromFile(new File(fileName)); if (m != null) { Log.d(LOG_TAG, " instruction video item: " + fileName); Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); Log.d(LOG_TAG, " file: " + fileName + " uri: " + uri); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); intent.putExtra("android.intent.extra.durationLimit", 5); intent.putExtra(MediaStore.EXTRA_FINISH_ON_COMPLETION, true); intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 5); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high // start the image capture Intent //context.startActivity(intent); // activity.startActivityForResult(intent, com.sandklef.coachapp.fragments.VideoCapture.VIDEO_CAPTURE); ((Activity) getContext()).startActivityForResult(intent, VIDEO_CAPTURE); } Log.d(LOG_TAG, " new instruction video wanted creation: " + fileName); return true; }
From source file:com.getchute.android.photopickerplus.ui.activity.ServicesActivity.java
@Override public void recordVideo() { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); mediaPath = AppUtil.getOutputMediaFileUri(MediaType.VIDEO); intent.putExtra(MediaStore.EXTRA_OUTPUT, mediaPath); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startTheCamera(intent, Constants.CAMERA_VIDEO_REQUEST); }