take pictures and videos in the selected resolution
This commit is contained in:
parent
d01a3ca636
commit
89e41d1fac
|
@ -4,10 +4,7 @@ import android.content.Context
|
||||||
import android.graphics.Point
|
import android.graphics.Point
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.hardware.Camera
|
import android.hardware.Camera
|
||||||
import android.media.AudioManager
|
import android.media.*
|
||||||
import android.media.MediaPlayer
|
|
||||||
import android.media.MediaRecorder
|
|
||||||
import android.media.MediaScannerConnection
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
@ -249,8 +246,8 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
||||||
var rotation = mActivity.getMediaRotation(mCurrCameraId)
|
var rotation = mActivity.getMediaRotation(mCurrCameraId)
|
||||||
rotation += mCallback.getCurrentOrientation().compensateDeviceRotation(mCurrCameraId)
|
rotation += mCallback.getCurrentOrientation().compensateDeviceRotation(mCurrCameraId)
|
||||||
|
|
||||||
/*final Camera.Size maxSize = getOptimalPictureSize();
|
val selectedResolution = getSelectedResolution()
|
||||||
mParameters.setPictureSize(maxSize.width, maxSize.height);*/
|
mParameters!!.setPictureSize(selectedResolution.width, selectedResolution.height);
|
||||||
mParameters!!.setRotation(rotation % 360)
|
mParameters!!.setRotation(rotation % 360)
|
||||||
|
|
||||||
if (config.isSoundEnabled) {
|
if (config.isSoundEnabled) {
|
||||||
|
@ -481,10 +478,11 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
||||||
|
|
||||||
mIsRecording = false
|
mIsRecording = false
|
||||||
mIsVideoMode = true
|
mIsVideoMode = true
|
||||||
mRecorder = MediaRecorder()
|
mRecorder = MediaRecorder().apply {
|
||||||
mRecorder!!.setCamera(mCamera)
|
setCamera(mCamera)
|
||||||
mRecorder!!.setVideoSource(MediaRecorder.VideoSource.DEFAULT)
|
setVideoSource(MediaRecorder.VideoSource.DEFAULT)
|
||||||
mRecorder!!.setAudioSource(MediaRecorder.AudioSource.DEFAULT)
|
setAudioSource(MediaRecorder.AudioSource.DEFAULT)
|
||||||
|
}
|
||||||
|
|
||||||
mCurrVideoPath = mActivity.getOutputMediaFile(false)
|
mCurrVideoPath = mActivity.getOutputMediaFile(false)
|
||||||
if (mCurrVideoPath.isEmpty()) {
|
if (mCurrVideoPath.isEmpty()) {
|
||||||
|
@ -492,11 +490,11 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/*final Camera.Size videoSize = getOptimalVideoSize();
|
val resolution = getSelectedResolution()
|
||||||
final CamcorderProfile cpHigh = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
|
val cpHigh = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)
|
||||||
cpHigh.videoFrameWidth = videoSize.width;
|
cpHigh.videoFrameWidth = resolution.width
|
||||||
cpHigh.videoFrameHeight = videoSize.height;
|
cpHigh.videoFrameHeight = resolution.height
|
||||||
mRecorder.setProfile(cpHigh);*/
|
mRecorder!!.setProfile(cpHigh)
|
||||||
|
|
||||||
if (mActivity.needsStupidWritePermissions(mCurrVideoPath)) {
|
if (mActivity.needsStupidWritePermissions(mCurrVideoPath)) {
|
||||||
if (config.treeUri.isEmpty()) {
|
if (config.treeUri.isEmpty()) {
|
||||||
|
|
Loading…
Reference in New Issue