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 only
supported content modes.
– initWithFrame:delegate:
Creates a video view with a frame and delegate.
@discussuion The default video rendering type is determined based upon your device model. For 64-bit devices the Metal APIs will be used otherwise OpenGL ES video rendering APIs will be used.
- (null_unspecified instancetype)initWithFrame:(CGRect)frame delegate:(nullable id<TVIVideoViewDelegate>)delegate
Parameters
frame |
The frame rectangle for the view. |
---|---|
delegate |
An object implementing the |
Return Value
A renderer which is appropriate for your device and OS combination.
Declared In
TVIVideoView.h
– initWithFrame:delegate:renderingType:
Creates a video view with a frame, delegate and rendering type.
- (null_unspecified instancetype)initWithFrame:(CGRect)frame delegate:(nullable id<TVIVideoViewDelegate>)delegate renderingType:(TVIVideoRenderingType)renderingType
Parameters
frame |
The frame rectangle for the view. |
---|---|
delegate |
An object implementing the |
renderingType |
The rendering type. |
Return Value
A renderer which uses a specific TVIVideoRenderingType
.
OpenGL rendering will be used if the rendering type is not supported on the current device.
Discussion
The rendering type, OpenGL ES supports zero copy rendering of NV12 sources. However, it currently fails
to create textures when the input is an NV12 CVPixelBuffer without kCVPixelBufferOpenGLTextureCacheCompatibilityKey
set to true
. This is only an issue for custom capturers which produce NV12 buffers without this flag set.
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.
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