【发布时间】:2018-07-09 00:04:06
【问题描述】:
当我使用相机意图捕捉视频时,用户可以选择所有相机应用程序。但我想强制用户只打开设备摄像头。我该怎么做?
我目前的意图:Intent captureIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
private void captureVideo() {
Intent captureIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
if (captureIntent.resolveActivity(conversationActivity.getPackageManager()) != null) {
if (captureVideoUri == null) {
captureVideoUri = Uri.fromFile(CameraHelper.getOutputMediaFile(CameraConfiguration.MEDIA_ACTION_VIDEO));
}
captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, captureVideoUri);
}
startActivityForResult(captureIntent, 1);
}
【问题讨论】:
-
这个答案链接可能会有所帮助stackoverflow.com/a/19051279/8770539
-
谢谢我检查了链接,但没有多大帮助:(
-
如果你想直接使用设备摄像头,你不应该使用INTENTs,你必须自己实现捕获。请参考:github.com/googlesamples/android-Camera2Video
标签: android video android-intent camera video-capture