TVIVideoView Class Reference

Inherits from UIView
Conforms to TVIVideoRenderer
Declared in TVIVideoView.h

Overview

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

When TVIVideoView 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.

Since the TVIVideoView uses metal, video rendering on iOS 11.x simulators is not supported.

– initWithFrame:delegate:

Creates a video view with a frame and delegate.

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

Parameters

frame

The frame rectangle for the view.

delegate

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

Return Value

A renderer.

Declared In

TVIVideoView.h

  delegate

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

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

Discussion

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

Declared In

TVIVideoView.h

  viewShouldRotateContent

Specify if the video view or the application will handle rotated video content.

@property (nonatomic, assign) BOOL viewShouldRotateContent

Discussion

Handling rotations at the application level is more complex, but allows you to smoothly animate transitions. By default, video frame rotation is performed by TVIVideoView. Set this property to NO if you want to handle rotations in your own layout using `[TVIVideoViewDelegate videoView:videoOrientationDidChange:].

Declared In

TVIVideoView.h

  videoDimensions

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

@property (nonatomic, assign, readonly) CMVideoDimensions videoDimensions

Declared In

TVIVideoView.h

  videoOrientation

The orientation of incoming video frames. Use this to layout TVIVideoView.

@property (nonatomic, assign, readonly) TVIVideoOrientation videoOrientation

Declared In

TVIVideoView.h

  hasVideoData

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

@property (atomic, assign, readonly) BOOL hasVideoData

Declared In

TVIVideoView.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

TVIVideoView.h