当前位置: 首页>>代码示例>>Java>>正文


Java MediaStore.ACTION_VIDEO_CAPTURE属性代码示例

本文整理汇总了Java中android.provider.MediaStore.ACTION_VIDEO_CAPTURE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaStore.ACTION_VIDEO_CAPTURE属性的具体用法?Java MediaStore.ACTION_VIDEO_CAPTURE怎么用?Java MediaStore.ACTION_VIDEO_CAPTURE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.provider.MediaStore的用法示例。


在下文中一共展示了MediaStore.ACTION_VIDEO_CAPTURE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: gravarVideo

private void gravarVideo(){
    Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    takeVideoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10);
    if (takeVideoIntent.resolveActivity(getPackageManager()) != null) {
        startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE);
    }
}
 
开发者ID:chacaldev,项目名称:provadevida,代码行数:7,代码来源:EnviarVideoActivity.java

示例2: takeVideo

private void takeVideo() {
    File dirVideo = new File(Environment.getExternalStorageDirectory(), "ktools/videos/");
    if (!dirVideo.exists()) {
        dirVideo.mkdirs();
    }
    outputVideoFile = new File(dirVideo.getAbsolutePath() + System.currentTimeMillis() + ".mp4");
    if (!outputVideoFile.exists()) {
        try {
            outputVideoFile.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    //兼容7.0
    Uri videoUri = FileProvider.getUriForFile(
            this,
            BuildConfig.APPLICATION_ID,
            outputVideoFile
    );
    Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    //指定输出
    intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri);
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
    intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 3000);
    startActivityForResult(intent, REQUEST_CODE_TAKE_VIDEO);
}
 
开发者ID:jiangkang,项目名称:KTools,代码行数:26,代码来源:ImageActivity.java

示例3: do_add_video

@OnClick(R.id.fab_add_video)
public void do_add_video()
{
    Intent capture = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    if (capture.resolveActivity(getPackageManager()) != null) {
        try {
            File videoFile = createFileName("traxyvid", ".mp4");
            mediaUri = FileProvider.getUriForFile(this,
                    getPackageName() + ".provider", videoFile);
            capture.putExtra(MediaStore.EXTRA_OUTPUT, mediaUri);
            startActivityForResult(capture, CAPTURE_VIDEO_REQUEST);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:16,代码来源:JournalViewActivity.java

示例4: startRecordingVideo

public void startRecordingVideo() {
    if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
        File storageDir = new File(Environment.getExternalStoragePublicDirectory(
                Environment.DIRECTORY_DCIM), "Camera");
        videoFile = new File(storageDir, "Commons_" + timeStamp + ".mp4");

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            videoUri = FileProvider.getUriForFile(MainActivity.this,
                    BuildConfig.APPLICATION_ID + ".provider",
                    videoFile);
        } else {
            videoUri = Uri.fromFile(videoFile);
        }

        intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri);
        intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
        startActivityForResult(intent, VIDEO_CAPTURE);
    } else {
        Toast.makeText(this, R.string.no_camera_on_device, Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:CommonsLab,项目名称:CommonsLab,代码行数:24,代码来源:MainActivity.java

示例5: onClick

@Override
public void onClick(View v) {
	int id = v.getId();
	switch (id) {
	case R.id.video_choose_cancel:
		finish();
		return;
	case R.id.video_choose_next:
		if (chooseVideo.size() == 0) {
			Toast.makeText(this, "至少选一个", 1).show();
		} else {
			ArrayList<String> videoPaths = new ArrayList<String>();
			for (Map.Entry entry : chooseVideo.entrySet()) {
				videoPaths.add(entry.getValue().toString());
			}
			Intent i = new Intent(this, HoDragVideo.class);
			i.putStringArrayListExtra("videos", videoPaths);
			startActivity(i);
		}
		return;
	default:
		break;
	}
	// TODO Auto-generated method stub
	if (v.getTag() != null && (int) v.getTag() == 1000) {
		Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

		Uri fileUri = getOutputMediaFileUri();
		intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
		intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
		startActivityForResult(intent, 1);
	} else {
		int chkId = 300000 + (int) v.getTag();
		CheckBox chk = (CheckBox) CameraMain2.this.findViewById(chkId);

		chk.setChecked(!chk.isChecked());
		// String videoPath = getPath((int) v.getTag());
		// Intent i = new Intent(CameraMain2.this, VideoPlayer.class);
		// i.putExtra("videoPath", videoPath);
		// i.putExtra("videoButton", (int) v.getTag() + 1000);
		// CameraMain2.this.startActivityForResult(i, 2);
	}
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:43,代码来源:CameraMain2.java

示例6: createCamcorderIntent

private Intent createCamcorderIntent() {
	Intent cameraIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
	File externalDataDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
	File cameraDataDir = new File(externalDataDir.getAbsolutePath() + File.separator + "browser-movies");
	cameraDataDir.mkdirs();
	mCameraFilePath = cameraDataDir.getAbsolutePath() + File.separator + System.currentTimeMillis() + ".mp4";
	cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(mCameraFilePath)));
	return cameraIntent;

}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:10,代码来源:MyWebChromeClient.java

示例7: openCamera

public void openCamera(Context context) {


        boolean image = mConfiguration.isImage();

        Intent captureIntent = image ? new Intent(MediaStore.ACTION_IMAGE_CAPTURE) : new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        if (captureIntent.resolveActivity(context.getPackageManager()) == null) {
            Toast.makeText(getContext(), R.string.gallery_device_camera_unable, Toast.LENGTH_SHORT).show();
            return;
        }

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA);
        String filename = String.format(image ? IMAGE_STORE_FILE_NAME : VIDEO_STORE_FILE_NAME, dateFormat.format(new Date()));
        Logger.i("openCamera:" + mImageStoreDir.getAbsolutePath());
        File fileImagePath = new File(mImageStoreDir, filename);
        mImagePath = fileImagePath.getAbsolutePath();

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
            captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(fileImagePath));
        } else {
            ContentValues contentValues = new ContentValues(1);
            contentValues.put(MediaStore.Images.Media.DATA, mImagePath);
            Uri uri = getContext().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
            captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
        }
        // video : 1: 高质量  0 低质量
//        captureIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
        startActivityForResult(captureIntent, TAKE_IMAGE_REQUEST_CODE);
    }
 
开发者ID:Loofer,项目名称:Watermark,代码行数:29,代码来源:MediaGridFragment.java

示例8: takeVideo

static void takeVideo(Map message) {
    if (message.containsKey("broadcast")) {
        broadcast = (Boolean) message.get("broadcast");
    }

   Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
   Activity activity = org.qtproject.qt5.android.QtNative.activity();
   if (takeVideoIntent.resolveActivity(activity.getPackageManager()) != null) {
       activity.startActivityForResult(takeVideoIntent, TAKE_VIDEO_ACTION );
   }
}
 
开发者ID:benlau,项目名称:androidnative.pri,代码行数:11,代码来源:VideoPicker.java

示例9: TakeVideo

void TakeVideo() {
    File fTemp;
    File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);

    try {
        if (!fCheckImagePermissions(CAMERA_PERMISSION_VIDEO))
            return;
        fTemp = File.createTempFile(TEMP_IMG_FILE_NAME, ".mp4", storageDir);
        fTemp.deleteOnExit();
        m_TempFilePath = fTemp.getAbsolutePath(); // need to save this for when the picture comes back

        SharedPreferences mPrefs = getActivity().getPreferences(Activity.MODE_PRIVATE);
        SharedPreferences.Editor ed = mPrefs.edit();
        ed.putString(keyTempFileInProgress, m_TempFilePath);
        ed.apply();

        Uri uriImage = FileProvider.getUriForFile(this.getContext(), "com.example.android.fileprovider", fTemp);

        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, uriImage);
        intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
        startActivityForResult(intent, CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE);
    } catch (IOException e) {
        Log.e(MFBConstants.LOG_TAG, Log.getStackTraceString(e));
        MFBUtil.Alert(getActivity(), getString(R.string.txtError), getString(R.string.errNoCamera));
    }
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:27,代码来源:ActMFBForm.java

示例10: recordVideo

/**
 * 录制视频
 */
public void recordVideo(Activity activity, int requestCode) {
    Intent takePictureIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    takePictureIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    if (takePictureIntent.resolveActivity(activity.getPackageManager()) != null) {

        if (Utils.existSDCard())
            takeImageFile = new File(Environment.getExternalStorageDirectory(), "/DCIM/Video/");
        else takeImageFile = Environment.getDataDirectory();
        takeImageFile = createFile(takeImageFile, "Video_", ".mp4");
        if (takeImageFile != null) {
            Uri fileUri;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                fileUri = FileProvider.getUriForFile(activity, activity.getPackageName(), takeImageFile);
                takePictureIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
                takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
            } else {
                fileUri = Uri.fromFile(takeImageFile);
            }
            // 默认情况下,即不需要指定intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
            // 照相机有自己默认的存储路径,拍摄的照片将返回一个缩略图。如果想访问原始图片,
            // 可以通过dat extra能够得到原始图片位置。即,如果指定了目标uri,data就没有数据,
            // 如果没有指定uri,则data就返回有数据!
            takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
        }
    }
    activity.startActivityForResult(takePictureIntent, requestCode);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:30,代码来源:ImagePicker.java

示例11: takeVideo

/**
 * 拍摄视频
 */
public static void takeVideo(Activity activity, int code) {
    Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);// 创建一个请求视频的意图
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0.95);// 设置视频的质量,值为0-1,
    intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 15);// 设置视频的录制长度,s为单位
    intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 5 * 1024 * 1024L);// 设置视频文件大小,字节为单位
    activity.startActivityForResult(intent, code);// 设置请求码,在onActivityResult()方法中接收结果
}
 
开发者ID:StickyTolt,项目名称:ForeverLibrary,代码行数:10,代码来源:MediaUtil.java

示例12: videoCapture

/**
 * Record videos.
 *
 * @param activity    activity.
 * @param requestCode code.
 * @param outPath     file path.
 * @param quality     currently value 0 means low quality, suitable for MMS messages, and  value 1 means high quality.
 * @param duration    specify the maximum allowed recording duration in seconds.
 * @param limitBytes  specify the maximum allowed size.
 */
public static void videoCapture(@NonNull Activity activity, int requestCode, File outPath,
                                @IntRange(from = 0, to = 1) int quality,
                                @IntRange(from = 1, to = Long.MAX_VALUE) long duration,
                                @IntRange(from = 1, to = Long.MAX_VALUE) long limitBytes) {
    Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    Uri uri = getUri(activity, outPath);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, quality);
    intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, duration);
    intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, limitBytes);
    activity.startActivityForResult(intent, requestCode);
}
 
开发者ID:WeiXinqiao,项目名称:Recognize-it,代码行数:22,代码来源:AlbumUtils.java

示例13: launchVideoRecord

private void launchVideoRecord() {
    final Intent intent =
            new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivityForResult(intent, REQUEST_VIDEO);
    }
}
 
开发者ID:aws-samples,项目名称:aws-mobile-simple-video-transcoding,代码行数:8,代码来源:MainActivity.java

示例14: recordVideo

public void recordVideo(View view) {
    // Capture video
    Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    if(takeVideoIntent.resolveActivity(getPackageManager()) != null) {
        startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE);
    }
}
 
开发者ID:Jiikuy,项目名称:VelocityCalculator,代码行数:7,代码来源:MainActivity.java

示例15: dispatchTakeVideoIntent

private void dispatchTakeVideoIntent(){
    Intent takePictureIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    if(takePictureIntent.resolveActivity(getPackageManager()) != null)
        startActivityForResult(takePictureIntent,REQUEST_VIDEO_CAPTURE);
}
 
开发者ID:zhuangzaiku,项目名称:AndroidCollection,代码行数:5,代码来源:CameraActivity.java


注:本文中的android.provider.MediaStore.ACTION_VIDEO_CAPTURE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。