feat: Add width
and height
to VideoFile
output (#2281)
* feat: Add `width` and `height` to `VideoFile` output * Format
This commit is contained in:
@@ -61,7 +61,8 @@ extension CameraSession {
|
||||
if status == .completed {
|
||||
// Recording was successfully saved
|
||||
let video = Video(path: recordingSession.url.absoluteString,
|
||||
duration: recordingSession.duration)
|
||||
duration: recordingSession.duration,
|
||||
size: recordingSession.size ?? CGSize.zero)
|
||||
onVideoRecorded(video)
|
||||
} else {
|
||||
// Recording wasn't saved and we don't have an error either.
|
||||
|
@@ -52,6 +52,13 @@ class RecordingSession {
|
||||
return assetWriter.outputURL
|
||||
}
|
||||
|
||||
/**
|
||||
Gets the size of the recorded video, in pixels.
|
||||
*/
|
||||
var size: CGSize? {
|
||||
return videoWriter?.naturalSize
|
||||
}
|
||||
|
||||
/**
|
||||
Get the duration (in seconds) of the recorded video.
|
||||
*/
|
||||
|
@@ -18,11 +18,17 @@ struct Video {
|
||||
Duration of the recorded video (in seconds)
|
||||
*/
|
||||
var duration: Double
|
||||
/**
|
||||
* The size of the video, in pixels.
|
||||
*/
|
||||
var size: CGSize
|
||||
|
||||
func toJSValue() -> NSDictionary {
|
||||
return [
|
||||
"path": path,
|
||||
"duration": duration,
|
||||
"width": size.width,
|
||||
"height": size.height,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user