CLUVideoWriter
@interface CLUVideoWriter : NSObject <CLUWritable>
CLUVideoWriter
class which responsible for all writing and saving process for video stream from device’s screen.
Used with Video Module to record screen while report recording is active
-
Size of final video. Depends on recorded view size
Declaration
Objective-C
@property (readonly, nonatomic) CGSize viewSize;
Swift
var viewSize: CGSize { get }
-
Current device’s screen scale. To generate bitmap with correct size depending on scale
Declaration
Objective-C
@property (readonly, nonatomic) CGFloat scale;
Swift
var scale: CGFloat { get }
-
URL of the final video file where Video Writer will save final recorded file
Declaration
Objective-C
@property (readonly, nonatomic) NSURL *outputURL;
Swift
var outputURL: URL! { get }
-
Create new instance of Video Writer with scpecific output URL, view size and scale
Declaration
Objective-C
- (instancetype)initWithOutputURL:(NSURL *)outputURL viewSize:(CGSize)size scale:(CGFloat)scale;
Swift
init!(outputURL: URL!, viewSize size: CGSize, scale: CGFloat)
Parameters
outputURL
URL of the final video file where Video Writer will save final recorded file
size
Size of final video. Depends on recorded view size
scale
Current device’s screen scale. To generate bitmap with correct size depending on scale
Return Value
New instance of Video Writer with configured properties
-
Append pixel buffer, current top view representation as a pixel buffer (See [UIView drawViewHierarchyInRect:afterScreenUpdates:] for drawing view Hierarchy on specific context) for specific timestamp
See
-bitmapContextForPixelBuffer:
Declaration
Objective-C
- (BOOL)appendPixelBuffer:(CVPixelBufferRef)pixelBuffer forTimestamp:(CMTime)timestamp;
Swift
func append(_ pixelBuffer: CVPixelBuffer!, forTimestamp timestamp: CMTime) -> Bool
Parameters
pixelBuffer
The
CVPixelBufferRef
to be appended.timestamp
The presentation time for the pixel buffer to be appended.
Return Value
A BOOL value indicating success of appending the pixel buffer. If a result of NO is returned, clients can check the value of
[CLUVideoWriter status]
to determine whether the writing operation completed, failed, or was cancelled. -
Declaration
Objective-C
- (AVAssetWriterStatus)status;
Swift
func status() -> AVAssetWriterStatus
Return Value
The status of writing samples to the receiver’s output file.
-
Create
CGContextRef
Bitmap context with correct width, height, color space and bytes per row for specific pixel bufferDeclaration
Objective-C
- (CGContextRef)bitmapContextForPixelBuffer:(CVPixelBufferRef *)pixelBuffer;
Swift
func bitmapContext(for pixelBuffer: UnsafeMutablePointer
Parameters
pixelBuffer
The empty
CVPixelBufferRef
Return Value
CGContextRef
Bitmap context on which client can draw view representation. (See [UIView drawViewHierarchyInRect:afterScreenUpdates:] to draw view on specific context)