I am developing the app for android media record, but some devices have different screen recording resolutions. And it always give me the crash.
I am using this code officially from google https://github.com/googlesamples/android-MediaRecorder/blob/master/Application/src/main/java/com/example/android/mediarecorder/MainActivity.java
it doesnt work also on Sony Xperia Z2 D6503
after I investigate this code
public static Camera.Size getOptimalVideoSize(List<Camera.Size> supportedVideoSizes,
List<Camera.Size> previewSizes, int w, int h)
doesn't work properly because it will result the size with 1280x720
and the log says
08-18 08:30:12.367 13251 13251 D MediaRecorder: Using Profile 0
08-18 08:30:12.367 13251 13251 D CameraTexture: vidsize = 720 : 1280
08-18 08:30:12.369 339 1370 W ServiceManager: Permission failure: com.sonyericsson.permission.CAMERA_EXTENDED from uid=19621 pid=13251
08-18 08:30:12.370 339 1370 W ServiceManager: Permission failure: com.sonyericsson.permission.CAMERA_EXTENDED from uid=19621 pid=13251
08-18 08:30:12.377 1478 1478 I art : Explicit concurrent mark sweep GC freed 21(1200B) AllocSpace objects, 0(0B) LOS objects, 40% free, 12MB/21MB, paused 806us total 23.539ms
08-18 08:30:12.390 13251 13251 E MediaRecorder: Starting Record
08-18 08:30:12.391 339 974 W StagefrightRecorder: Intended video encoding frame width (1280) is too large and will be set to (800)
08-18 08:30:12.392 339 974 W StagefrightRecorder: Intended video encoding frame height (720) is too large and will be set to (480)
08-18 08:30:12.393 339 974 E CameraSource: Video dimension (800x480) is unsupported
08-18 08:30:12.394 13251 13251 E MediaRecorder: start failed: -19
I don't know how to properly create the mediarecorder that can be used on all android devices. Is there any reference for this?