修改录像帧率
This commit is contained in:
parent
7d4355a648
commit
0a91a39c6f
@ -205,35 +205,14 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
|
||||
stopVideo = findViewById(R.id.btn_stop_video);
|
||||
stopVideo.setOnClickListener(this::onClick);
|
||||
//拍照权限
|
||||
camera.setLifecycleOwner(this);
|
||||
camera.setEngine(Engine.CAMERA1);
|
||||
// camera.setVideoBitRate(5);
|
||||
camera.setPreviewFrameRate(5); // 设置预览视频的帧率
|
||||
|
||||
|
||||
// 设置视频可用的宽高size
|
||||
SizeSelector width = SizeSelectors.maxWidth(1920);
|
||||
SizeSelector height = SizeSelectors.maxHeight(1440);
|
||||
SizeSelector dimensions = SizeSelectors.and(width, height); // Matches sizes bigger than 1000x2000.
|
||||
// 获取屏幕信息
|
||||
int[] density = DensityUtil.getDeviceInfo(this);
|
||||
int x = 1920, y = 1440;
|
||||
if (density != null && density.length > 1) {
|
||||
x = (density[0] >= density[1] ? density[0] : density[1]);
|
||||
y = (density[0] >= density[1] ? density[1] : density[0]);
|
||||
}
|
||||
SizeSelector ratio = SizeSelectors.aspectRatio(AspectRatio.of(x, y), 0); // Matches 1:1 sizes.
|
||||
|
||||
SizeSelector result = SizeSelectors.or(
|
||||
SizeSelectors.and(ratio, dimensions), // Try to match both constraints
|
||||
ratio, // If none is found, at least try to match the aspect ratio
|
||||
SizeSelectors.biggest() // If none is found, take the biggest
|
||||
);
|
||||
camera.setVideoSize(result);
|
||||
camera.setVideoBitRate(1920 * 1440);
|
||||
// camera.setAudioBitRate();
|
||||
|
||||
/**
|
||||
* camera.setVideoBitRate(2000000);
|
||||
* 设置帧率
|
||||
* 在清单文件核心代码
|
||||
* app:cameraVideoSizeMaxWidth="2000"
|
||||
* app:cameraVideoSizeMaxArea="2000000"
|
||||
*/
|
||||
camera.setVideoBitRate(2000000);
|
||||
//获取地图
|
||||
tencentMap = ivMap.getMap();
|
||||
|
||||
|
@ -186,35 +186,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
|
||||
stopPicture = findViewById(R.id.btn_stop_picture);
|
||||
stopPicture.setOnClickListener(this::onClick);
|
||||
//拍照权限
|
||||
camera.setLifecycleOwner(this);
|
||||
camera.setEngine(Engine.CAMERA1);
|
||||
// camera.setVideoBitRate(5);
|
||||
camera.setPreviewFrameRate(5); // 设置预览视频的帧率
|
||||
|
||||
|
||||
// 设置视频可用的宽高size
|
||||
SizeSelector width = SizeSelectors.maxWidth(1920);
|
||||
SizeSelector height = SizeSelectors.maxHeight(1440);
|
||||
SizeSelector dimensions = SizeSelectors.and(width, height); // Matches sizes bigger than 1000x2000.
|
||||
// 获取屏幕信息
|
||||
int[] density = DensityUtil.getDeviceInfo(this);
|
||||
int x = 1920, y = 1440;
|
||||
if (density != null && density.length > 1) {
|
||||
x = (density[0] >= density[1] ? density[0] : density[1]);
|
||||
y = (density[0] >= density[1] ? density[1] : density[0]);
|
||||
}
|
||||
SizeSelector ratio = SizeSelectors.aspectRatio(AspectRatio.of(x, y), 0); // Matches 1:1 sizes.
|
||||
|
||||
SizeSelector result = SizeSelectors.or(
|
||||
SizeSelectors.and(ratio, dimensions), // Try to match both constraints
|
||||
ratio, // If none is found, at least try to match the aspect ratio
|
||||
SizeSelectors.biggest() // If none is found, take the biggest
|
||||
);
|
||||
camera.setVideoSize(result);
|
||||
camera.setVideoBitRate(1920 * 1440);
|
||||
// camera.setAudioBitRate();
|
||||
|
||||
//获取地图
|
||||
tencentMap = ivMap.getMap();
|
||||
//获取地图UI 设置对象
|
||||
|
@ -11,6 +11,8 @@
|
||||
android:layout_height="match_parent">
|
||||
<com.otaliastudios.cameraview.CameraView
|
||||
android:id="@+id/camera"
|
||||
app:cameraVideoSizeMaxWidth="2000"
|
||||
app:cameraVideoSizeMaxArea="2000000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:keepScreenOn="true"
|
||||
|
Loading…
x
Reference in New Issue
Block a user