Closed colin-hanbury closed 3 years ago
@pinkfish I have found a fix for this issue. Adding the not-null assertion operator to the following prevents the type mismatch errors from occurring:
android\src\main\kotlin\com\whelksoft\camera_with_rtmp\Camera.kt line 682:
sensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION)!!
android\src\main\kotlin\com\whelksoft\camera_with_rtmp\CameraUtils.kt line 51:
details["sensorOrientation"] = sensorOrientation!!
android\src\main\kotlin\com\whelksoft\camera_with_rtmp\VideoEncoder.kt line 427:
processOutput(byteBuffer!!, mediaCodec, outBufferIndex, bufferInfo)
android\src\main\kotlin\com\whelksoft\camera_with_rtmp\VideoEncoder.kt line 218:
val byteBufferList = extractVpsSpsPpsFromH265(mediaFormat.getByteBuffer("csd-0")!!)
I've been unable to run on an android device due to the following failure during the gradle build:
FAILURE: Build failed with an exception.
...\flutter.pub-cache\hosted\pub.dartlang.org\camera_with_rtmp-0.3.2\android\src\main\kotlin\com\whelksoft\camera_with_rtmp\Camera.kt: (682, 29): Type mismatch: inferred type is Int? but Int was expected ...\flutter.pub-cache\hosted\pub.dartlang.org\camera_with_rtmp-0.3.2\android\src\main\kotlin\com\whelksoft\camera_with_rtmp\Camera.kt: (682, 45): Type mismatch: inferred type is Int? but Int was expected ...\flutter.pub-cache\hosted\pub.dartlang.org\camera_with_rtmp-0.3.2\android\src\main\kotlin\com\whelksoft\camera_with_rtmp\CameraUtils.kt: (51, 44): Type mismatch: inferred type is Int? but TypeVariable(V) was expected ...\flutter.pub-cache\hosted\pub.dartlang.org\camera_with_rtmp-0.3.2\android\src\main\kotlin\com\whelksoft\camera_with_rtmp\VideoEncoder.kt: (427, 23): Type mismatch: inferred type is ByteBuffer? but ByteBuffer was expected
snippet from pubspec.yaml:
build.gradle:
app\build.gradle:
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel master, 1.24.0-4.0.pre.107, on Microsoft Windows [√] Android toolchain - develop for Android devices (Android SDK version 30.0.2) [√] Android Studio (version 4.1.0) [√] IntelliJ IDEA Community Edition (version 2019.3) [√] VS Code (version 1.47.3) [√] Connected device (1 available)
• No issues found!