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:org.matrix.console.activity.RoomActivity.java
/** * Launch the camera/*from w ww . ja va 2 s. com*/ */ private void launchVideo() { final Intent captureIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); // lowest quality captureIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); RoomActivity.this.runOnUiThread(new Runnable() { @Override public void run() { startActivityForResult(captureIntent, TAKE_VIDEO); } }); }
From source file:com.dycode.jepretstory.mediachooser.activity.BucketHomeFragmentActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int itemID = item.getItemId(); if (itemID == android.R.id.home) { materialMenu.animateTouch();// w ww .jav a 2 s .c o m finish(); } else if (itemID == R.id.menuNext) { if (mSelectedImages.size() == 0 && mSelectedImages.size() == 0) { Toast.makeText(BucketHomeFragmentActivity.this, getString(R.string.plaese_select_file), Toast.LENGTH_SHORT).show(); } else { if (mSelectedVideos.size() > 0) { Intent videoIntent = new Intent(); videoIntent.setAction(MediaChooser.VIDEO_SELECTED_ACTION_FROM_MEDIA_CHOOSER); //videoIntent.putStringArrayListExtra("list", mSelectedVideo); videoIntent.putParcelableArrayListExtra("selectedVideos", mSelectedVideos); setResult(RESULT_OK, videoIntent); sendBroadcast(videoIntent); } if (mSelectedImages.size() > 0) { Intent imageIntent = new Intent(); imageIntent.setAction(MediaChooser.IMAGE_SELECTED_ACTION_FROM_MEDIA_CHOOSER); //imageIntent.putStringArrayListExtra("list", mSelectedImage); imageIntent.putParcelableArrayListExtra("selectedImages", mSelectedImages); setResult(RESULT_OK, imageIntent); sendBroadcast(imageIntent); } finish(); } } else if (itemID == R.id.menuCamera) { if (currentMediaMode == MediaType.VIDEO) { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); // create a file to save the image fileUri = getOutputMediaFileUri(MediaChooserConstants.MEDIA_TYPE_VIDEO); //fileUri = getVideoInMediaStore(fileUri); // set the image file name intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); Long limit = Long.valueOf((MediaChooserConstants.SELECTED_VIDEO_SIZE_IN_MB * 1024 * 1024)); intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, limit); intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, MediaChooserConstants.VIDEO_DURATION_LIMIT_IN_SECOND); // start the image capture Intent startActivityForResult(intent, MediaChooserConstants.CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE); } else { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // create a file to save the image fileUri = getOutputMediaFileUri(MediaChooserConstants.MEDIA_TYPE_IMAGE); // set the image file name intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // start the image capture Intent startActivityForResult(intent, MediaChooserConstants.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); } } return super.onOptionsItemSelected(item); }
From source file:com.dycode.jepretstory.mediachooser.activity.HomeFragmentActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int itemID = item.getItemId(); if (itemID == android.R.id.home) { materialMenu.animateTouch();/* w w w. j a v a 2 s.co m*/ finish(); } else if (itemID == R.id.menuNext) { //android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager(); if (mVideoFragment != null || mImageFragment != null) { if (mVideoFragment != null) { if (mVideoFragment.getSelectedVideos() != null && mVideoFragment.getSelectedVideos().size() > 0) { Intent videoIntent = new Intent(); videoIntent.setAction(MediaChooser.VIDEO_SELECTED_ACTION_FROM_MEDIA_CHOOSER); //videoIntent.putStringArrayListExtra("list", mVideoFragment.getSelectedVideoList()); videoIntent.putParcelableArrayListExtra("selectedVideos", mVideoFragment.getSelectedVideos()); setResult(RESULT_OK, videoIntent); sendBroadcast(videoIntent); } } if (mImageFragment != null) { if (mImageFragment.getSelectedImages() != null && mImageFragment.getSelectedImages().size() > 0) { Intent imageIntent = new Intent(); imageIntent.setAction(MediaChooser.IMAGE_SELECTED_ACTION_FROM_MEDIA_CHOOSER); //imageIntent.putStringArrayListExtra("list", mImageFragment.getSelectedImageList()); imageIntent.putParcelableArrayListExtra("selectedImages", mImageFragment.getSelectedImages()); setResult(RESULT_OK, imageIntent); sendBroadcast(imageIntent); } } finish(); } else { Toast.makeText(HomeFragmentActivity.this, getString(R.string.plaese_select_file), Toast.LENGTH_SHORT).show(); } } else if (itemID == R.id.menuCamera) { if (currentMediaMode == MediaType.VIDEO) { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); fileUri = getOutputMediaFileUri(MediaType.VIDEO); // create a file to save the image intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); Long limit = Long.valueOf((MediaChooserConstants.SELECTED_VIDEO_SIZE_IN_MB * 1024 * 1024)); intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, limit); intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, MediaChooserConstants.VIDEO_DURATION_LIMIT_IN_SECOND); // start the image capture Intent startActivityForResult(intent, MediaChooserConstants.CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE); } else { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); fileUri = getOutputMediaFileUri(MediaType.IMAGE); // create a file to save the image intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name // start the image capture Intent startActivityForResult(intent, MediaChooserConstants.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); } } return super.onOptionsItemSelected(item); }
From source file:com.bf.zxd.zhuangxudai.my.fragment.FinancialApplyFragment.java
private void ChangeIcon() { //PopupWindow----START-----??PopupWindowPopupWindow??? backgroundAlpha(0.3f);/* w w w .ja v a2 s . c om*/ View view = LayoutInflater.from(getActivity().getBaseContext()).inflate(R.layout.popu_window, null); final PopupWindow popupWindow = new PopupWindow(view, ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT, true); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); popupWindow.setOutsideTouchable(true); popupWindow.setFocusable(true); //?? DisplayMetrics dm = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); popupWindow.setWidth(dm.widthPixels); popupWindow.setAnimationStyle(R.style.popuwindow); //? popupWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0); popupWindow.setOnDismissListener(new poponDismissListener_FinancialApplyFragment()); //PopupWindow-----END //PopupWindow Button button = (Button) view.findViewById(R.id.take_photo);//?? Button button1 = (Button) view.findViewById(R.id.all_photo);//? Button button2 = (Button) view.findViewById(R.id.out);//? button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { backgroundAlpha(1f); popupWindow.dismiss(); } }); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { backgroundAlpha(1f); popupWindow.dismiss(); //,? allPhoto(); } }); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { backgroundAlpha(1f); popupWindow.dismiss(); //,Intent???? Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //,?? File file = FileUitlity.getInstance(getActivity().getApplicationContext()).makeDir("head_image"); //?? path = file.getParent() + File.separatorChar + System.currentTimeMillis() + ".jpg"; //?IntentIntent? intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(path))); //? intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); //?Intent??RoundImageView startActivityForResult(intent, REQUEST_CODE); } }); }
From source file:org.odk.collect.android.widgets.VideoWidget.java
private void captureVideo() { Intent i;//from w ww. java 2 s . co m if (selfie) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { i = new Intent(getContext(), CaptureSelfieVideoActivityNewApi.class); } else { i = new Intent(getContext(), CaptureSelfieVideoActivity.class); } } else { i = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); // 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 Timber.i("The build of this device is %s", MODEL); if (NEXUS7.equals(MODEL) && Build.VERSION.SDK_INT == 18) { nexus7Uri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO); i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, nexus7Uri); } else { i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Video.Media.EXTERNAL_CONTENT_URI.toString()); } } SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(Collect.getInstance()); // request high resolution if configured for that... boolean highResolution = settings.getBoolean(GeneralKeys.KEY_HIGH_RESOLUTION, VideoWidget.DEFAULT_HIGH_RESOLUTION); if (highResolution) { i.putExtra(android.provider.MediaStore.EXTRA_VIDEO_QUALITY, 1); } try { waitForData(); ((Activity) getContext()).startActivityForResult(i, RequestCodes.VIDEO_CAPTURE); } catch (ActivityNotFoundException e) { Toast.makeText(getContext(), getContext().getString(R.string.activity_not_found, getContext().getString(R.string.capture_video)), Toast.LENGTH_SHORT).show(); cancelWaitingForData(); } }
From source file:com.bf.zxd.zhuangxudai.my.fragment.CompanyApplyFragment.java
private void ChangeIcon() { //PopupWindow----START-----??PopupWindowPopupWindow??? backgroundAlpha(0.3f);//w w w .j av a 2s. c o m View view = LayoutInflater.from(getActivity().getBaseContext()).inflate(R.layout.popu_window, null); final PopupWindow popupWindow = new PopupWindow(view, ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT, true); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); popupWindow.setOutsideTouchable(true); popupWindow.setFocusable(true); //?? DisplayMetrics dm = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); popupWindow.setWidth(dm.widthPixels); popupWindow.setAnimationStyle(R.style.popuwindow); //? popupWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0); popupWindow.setOnDismissListener(new poponDismissListener_CompanyApplyFragment()); //PopupWindow-----END //PopupWindow Button button = (Button) view.findViewById(R.id.take_photo);//?? Button button1 = (Button) view.findViewById(R.id.all_photo);//? Button button2 = (Button) view.findViewById(R.id.out);//? button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { backgroundAlpha(1f); popupWindow.dismiss(); } }); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { backgroundAlpha(1f); popupWindow.dismiss(); //,? Log.i("Daniel", "------"); allPhoto(); } }); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { backgroundAlpha(1f); popupWindow.dismiss(); //,Intent???? Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //,?? File file = FileUitlity.getInstance(getActivity().getApplicationContext()).makeDir("head_image"); //?? path = file.getParent() + File.separatorChar + System.currentTimeMillis() + ".jpg"; //?IntentIntent? intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(path))); //? intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); //?Intent??RoundImageView startActivityForResult(intent, REQUEST_CODE); } }); }
From source file:net.jongrakko.zipsuri.activity.PostReviseActivity.java
private void takeVideo() { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); takeFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "Zisuri_tmp_" + System.currentTimeMillis() + ".mp4"); Uri saveUri = Uri.fromFile(takeFile); intent.putExtra(MediaStore.EXTRA_OUTPUT, saveUri); // set the image file name intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high startActivityForResult(intent, TAKE_VIDEO_FOR_AVATAR); }
From source file:com.example.zf_android.activity.MerchantEdit.java
private void show2Dialog(int type) { AlertDialog.Builder builder = new AlertDialog.Builder(MerchantEdit.this); final String[] items = getResources().getStringArray(R.array.apply_detail_upload); MerchantEdit.this.type = type; builder.setItems(items, new DialogInterface.OnClickListener() { @Override//from www . ja v a2 s . c om public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: { Intent intent; if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); } else { intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); } startActivityForResult(intent, REQUEST_UPLOAD_IMAGE); break; } case 1: { String state = Environment.getExternalStorageState(); if (state.equals(Environment.MEDIA_MOUNTED)) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File outDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); if (!outDir.exists()) { outDir.mkdirs(); } File outFile = new File(outDir, System.currentTimeMillis() + ".jpg"); photoPath = outFile.getAbsolutePath(); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(outFile)); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(intent, REQUEST_TAKE_PHOTO); } else { CommonUtil.toastShort(MerchantEdit.this, getString(R.string.toast_no_sdcard)); } break; } } } }); builder.show(); }
From source file:com.rsmsa.accapp.MainActivity.java
/** * Recording video/*from w w w . j a v a2s . c o m*/ */ private void recordVideo() { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO); // set video quality intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file // name // start the video capture Intent startActivityForResult(intent, CAMERA_CAPTURE_VIDEO_REQUEST_CODE); }
From source file:com.google.yydw.MainActivity.java
public void recordVideo(View view) { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); // Workaround for Nexus 7 Android 4.3 Intent Returning Null problem // create a file to save the video in specific folder (this works for // video only) // mFileURI = getOutputMediaFile(MEDIA_TYPE_VIDEO); // intent.putExtra(MediaStore.EXTRA_OUTPUT, mFileURI); // set the video image quality to high intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // start the Video Capture Intent startActivityForResult(intent, RESULT_VIDEO_CAP); }