意图采取安卓视频 [英] Intent to take video in android

查看:226
本文介绍了意图采取安卓视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从视频只使用前置摄像头我的应用程序。我使用的意图来执行此操作。

I need to take video from my application using only front camera. I am using intent to perform this action.

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri);
intent.putExtra("android.intent.extra.durationLimit", 30);
intent.putExtra("android.intent.extras.CAMERA_FACING", 1); //to open front facing camera
startActivityForResult(intent, VIDEO_CAPTURE);

当我运行的应用程序,我可以使用前置摄像头拍摄录像。但是假设当我点击我的录像按钮,摄像头视图打开。在用户去改变相机后置摄像头,则一直是我的意图后,才打开后置摄像头。它没有采取行

When I run the application, I am able to take video using front camera. But suppose when I click my record video button and the camera view is opened. In that user go and change the camera to rear camera, then always my intent is opening rear camera only after that. Its not taking the line

intent.putExtra("android.intent.extras.CAMERA_FACING", 1);

可能有人请告诉我什么问题,是它能够使用意图解决?

Could someone please tell me whats the issue and is it able to be solved using intent?

推荐答案

还有就是用意图展现了前置摄像头所有的时间至少不会在所有设备上没有可靠的方法。只有这样,才能可靠地做到这一点是建立一个SurfaceView和自己拍摄的视频。

There is no reliable way to use intent to show the front camera all the time at least not on all devices. Only way to reliably do it is to create a SurfaceView and capture the video yourself.

这篇关于意图采取安卓视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆