feat: Add width and height to VideoFile output (#2281)

* feat: Add `width` and `height` to `VideoFile` output

* Format
This commit is contained in:
Marc Rousavy
2023-12-12 16:43:57 +01:00
committed by GitHub
parent 98f08800f2
commit 9a187c6d19
6 changed files with 27 additions and 3 deletions

View File

@@ -25,6 +25,8 @@ suspend fun CameraView.startRecording(options: RecordVideoOptions, onRecordCallb
val map = Arguments.createMap()
map.putString("path", video.path)
map.putDouble("duration", video.durationMs.toDouble() / 1000.0)
map.putInt("width", video.size.width)
map.putInt("height", video.size.height)
onRecordCallback(map, null)
}
val onError = { error: RecorderError ->

View File

@@ -32,7 +32,7 @@ class RecordingSession(
private const val AUDIO_CHANNELS = 1
}
data class Video(val path: String, val durationMs: Long)
data class Video(val path: String, val durationMs: Long, val size: Size)
private val bitRate = getBitRate()
private val recorder: MediaRecorder
@@ -106,7 +106,7 @@ class RecordingSession(
val stopTime = System.currentTimeMillis()
val durationMs = stopTime - (startTime ?: stopTime)
callback(Video(outputFile.absolutePath, durationMs))
callback(Video(outputFile.absolutePath, durationMs, size))
}
}