SessionVideo
@objcMembers
public class SessionVideo : NSObject, Codable
For more information see Session documentation.
-
The pixel dimensions of the final video.
If not manually set, this will be equal to the size of the cropRect of the first segment. If there is no cropRect, it is equal to the actualSize of the first segment. If the first segment later changes, the renderSize will not also change.
If you manually change the renderSize, you will need to update the cropRect for each segment if the renderSize width/height ratio has changed. You can avoid this by setting the
CameraControlleraspectRatioandPreviewCropControlleraspectRatiobeforehand.If you provide floating point numbers, they will be rounded using the Drawin.round() function.
If you provide odd numbers, they will be reduced to the next lower even number, e.g. 5 becomes 4. This is because AVFoundation can’t handle odd pixel dimensions when writing video files and will instead substitute in a green line.
Declaration
Swift
public var renderSize: CGSize { get set }
-
The video segments in the video.
Precondition
There must be one or more videoSegments.Declaration
Swift
public internal(set) var videoSegments: [SessionVideoSegment] { get set }
-
The active primary filter. This will be set when a filter is selected from the
EditControllerFilter tab.Declaration
Swift
public var primaryFilter: SessionFilter? { get set } -
All active filters not including the primaryFilter. The
EditControllerAdjust tab will place filters here.The filters in this array will be applied to every segment and in ascending order.
Declaration
Swift
public var filters: [SessionFilter] { get set }
-
The total duration of the video.
Calculated by adding the
renderDurationof every segment together.Declaration
Swift
public var duration: CMTime { get } -
The framerate for the video.
For example, a frameDuration of 1/30th of a second
CMTime(value: 1, timescale: 30)would be a 30fps video.If not manually set, it is calculated by picking the shortest frameDuration from the segments. In other words, it picks the highest framerate from the segments. This is similar to the method used by videoCompositionWithPropertiesOfAsset:.
Will be
CMTime.positiveInfinityif the video has no segments.Declaration
Swift
public var frameDuration: CMTime { get set }
-
The playback speed of the video.
Precondition
Must be greater than zero.
Note
The speed of individual segments can be set with
SessionVideoSegmentspeedMultiplierinstead.For example:
A value of
2with result in 2x faster playback speed.A value of
.5will result .5x slower playback speed.A value of
1will result in normal playback speed.Default value:
1Declaration
Swift
public var speedMultiplier: Double { get set }
-
The URL location of the final video file (with all segments stiched together) after it has been exported. There will only be a file here after the export has been completed for the video. You may move, copy or delete this file. See
VideoExporterfor more information.Declaration
Swift
public var exportedVideoURL: URL { get } -
The UTC date when the last successful video export started.
Declaration
Swift
public internal(set) var dateExported: Date? { get } -
Indicates if the export was completed.
If the sessions dateModified is an older date than the videos dateExported, this will be false. In other words, if you export the video this will become true but if you then make modifications to the video this will flip back to false. The exportedVideoURL file must also exist for this to be true.
Declaration
Swift
public var isExported: Bool { get }
View on GitHub
SessionVideo Class Reference