TVISampleBufferVideoView Class Reference

Inherits from UIView
Conforms to TVIVideoRenderer
Declared in TVISampleBufferVideoView.h

Overview

A TVISampleBufferVideoView draws video frames from a TVIVideoTrack. TVISampleBufferVideoView should only be used on the application’s main thread. Subclassing TVISampleBufferVideoView is not supported. UIViewContentModeScaleToFill, UIViewContentModeScaleAspectFill and UIViewContentModeScaleAspectFit are the supported content modes.

When TVISampleBufferVideoView is contained within a UIWindowScene on iOS 13.0+, it registers for lifecycle notifications from the scene. When the view is used on earlier versions of iOS or added to a UIWindow without a UIWindowScene, it registers for UIApplication lifecycle notifications instead.

– initWithFrame:delegate:

Creates a video view with a frame and delegate.

- (null_unspecified instancetype)initWithFrame:(CGRect)frame delegate:(nullable id<TVISampleBufferVideoViewDelegate>)delegate

Parameters

frame

The frame rectangle for the view.

delegate

An object implementing the TVISampleBufferVideoViewDelegate protocol (often a UIViewController).

Return Value

A renderer.

Declared In

TVISampleBufferVideoView.h

  delegate

A delegate which receives callbacks when important view rendering events occur.

@property (nonatomic, weak, nullable) id<TVISampleBufferVideoViewDelegate> delegate

Discussion

Note: The delegate is always called on the main thread in order to synchronize with UIKit.

Declared In

TVISampleBufferVideoView.h

  videoDimensions

The dimensions of incoming video frames (without rotations applied). Use this to layout TVISampleBufferVideoView.

@property (nonatomic, assign, readonly) CMVideoDimensions videoDimensions

Declared In

TVISampleBufferVideoView.h

  hasVideoData

Indicates that at least one frame of video data has been received.

@property (nonatomic, assign, readonly) BOOL hasVideoData

Declared In

TVISampleBufferVideoView.h

  mirror

Determines whether the view should be mirrored.

@property (nonatomic, assign, getter=shouldMirror) BOOL mirror

Discussion

This is useful when rendering the local feed from the front camera. The default is NO.

Declared In

TVISampleBufferVideoView.h