SessionVideo

@objcMembers
public class SessionVideo : NSObject, Codable

For more information see Session documentation.

Video Size

  • 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 CameraController aspectRatio and PreviewCropController aspectRatio beforehand.

    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 }

Segments

  • The video segments in the video.

    Precondition

    There must be one or more videoSegments.

    Declaration

    Swift

    public internal(set) var videoSegments: [SessionVideoSegment] { get set }

Current Filters

  • The active primary filter. This will be set when a filter is selected from the EditController Filter tab.

    Declaration

    Swift

    public var primaryFilter: SessionFilter? { get set }
  • All active filters not including the primaryFilter. The EditController Adjust 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 }

Durations

  • The total duration of the video.

    Calculated by adding the renderDuration of 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.positiveInfinity if the video has no segments.

    Declaration

    Swift

    public var frameDuration: CMTime { get set }

Speed

  • The playback speed of the video.

    Precondition

    Must be greater than zero.

    Note

    The speed of individual segments can be set with SessionVideoSegment speedMultiplier instead.

    For example:

    A value of 2 with result in 2x faster playback speed.

    A value of .5 will result .5x slower playback speed.

    A value of 1 will result in normal playback speed.

    Default value: 1

    Declaration

    Swift

    public var speedMultiplier: Double { get set }

Export Status

  • 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 VideoExporter for 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 }