Meh*_*sar 4 camera android android-intent android-camera-intent android-orientation
我试图在捕获视频时坚持用户使用横向模式.
Question 1: Can I force user to use landscape mode while video capturing?
Question 2: Can I show some overlay image or alert to suggest the user for landscape mode when user holds device in portrait mode?
Run Code Online (Sandbox Code Playgroud)
我尝试使用默认的Camera App和下面的代码来实现它,
Intent mOptionIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
mOptionIntent.putExtra("return-data", true);
startActivityForResult(mOptionIntent, REQUEST_CAPTURE_VIDEO);
Run Code Online (Sandbox Code Playgroud)
我发现我们可以通过指定EXTRA_SCREEN_ORIENTATION来请求输出数据的方向,如下所示.只有在OEMs没有修改的情况下它才可以在某些设备上工作.即使它发生了,相机可能会打开Portrait并保存数据Landscape orientation,所以有无法设置Landscape相机:
mOptionIntent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Run Code Online (Sandbox Code Playgroud)
所以我关心的是关于视频捕捉的定位,我想insist user or lock the screen in Landscape mode.
我创建了一个名为LandscapeVideoCapture的库,它正是这样做的.
在纵向中,您将获得一个图像,指示用户应该旋转他的设备,并且只有当设备处于横向状态时,用户才能真正开始捕获视频.
请在此处查看:https://github.com/jmolsmobile/LandscapeVideoCapture
此外,该库还具有许多其他功能,如设置分辨率,帧速率,捕获质量,......
| 归档时间: |
|
| 查看次数: |
1305 次 |
| 最近记录: |