TVIAppScreenSource Class Reference

Inherits from NSObject
Conforms to TVIVideoSource
Declared in TVIAppScreenSource.h

Overview

TVIAppScreenSource is a TVIVideoSource that allows you to stream video of the app screen. This class manages a RPScreenRecorder internally.

– init

Initializes a TVIAppScreenSource with default options. You may set a delegate later if you wish.

- (null_unspecified instancetype)init

Return Value

A TVIAppScreenSource, or nil if one could not be created.

Discussion

When running on the simulator nil will be returned.

Declared In

TVIAppScreenSource.h

– initWithDelegate:

Initializes a TVIAppScreenSource with a delegate and default options.

- (nullable instancetype)initWithDelegate:(nullable id<TVIAppScreenSourceDelegate>)delegate

Parameters

delegate

A delegate conforming to TVIAppScreenSourceDelegate, or nil.

Return Value

A TVIAppScreenSource, or nil if one could not be created.

Discussion

When running on the simulator nil will be returned. The delegate is called on the main queue.

Declared In

TVIAppScreenSource.h

– initWithOptions:delegate:

Initializes a TVIAppScreenSource with all configuration options.

- (nullable instancetype)initWithOptions:(nonnull TVIAppScreenSourceOptions *)options delegate:(nullable id<TVIAppScreenSourceDelegate>)delegate

Parameters

options

A TVIAppScreenSourceOptions instance to configure your source.

delegate

A delegate conforming to TVIAppScreenSourceDelegate, or nil.

Return Value

A TVIAppScreenSource, or nil if one could not be created.

Discussion

When running on the simulator nil will be returned. The delegate is called on the main queue.

Declared In

TVIAppScreenSource.h

  delegate

The source’s delegate.

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

Discussion

The delegate is called on the main queue.

Declared In

TVIAppScreenSource.h

  isAvailable

Indicates whether the screen is available for capture.

@property (nonatomic, readonly) BOOL isAvailable

Discussion

When set to YES, the screen is available for capture. Screen capture can be unavailable due to unsupported hardware, the user’s device displaying information over AirPlay or through a TVOut session, or another app using ReplayKit.

Declared In

TVIAppScreenSource.h

  isCapturing

Indicates whether the screen is being captured.

@property (nonatomic, readonly) BOOL isCapturing

Discussion

When set to YES, the screen is being captured.

Declared In

TVIAppScreenSource.h

– startCapture

Starts capture. The video pipeline will start asynchronously after this method returns.

- (void)startCapture

Discussion

The system will lock screen orientation during screen capture. When you are done capturing video using the TVIAppScreenSource you must call either [TVIAppScreenSource stopCapture] or [TVIAppScreenSource stopCaptureWithCompletion:].

Declared In

TVIAppScreenSource.h

– startCaptureWithCompletion:

Starts capture with a completion handler.

- (void)startCaptureWithCompletion:(nullable TVIAppScreenSourceStartedBlock)completion

Parameters

completion

A handler block to be called on the main queue once capture has started, or failed to start.

Discussion

The system will lock screen orientation during screen capture. When you are done capturing video using the TVIAppScreenSource you must call either [TVIAppScreenSource stopCapture] or [TVIAppScreenSource stopCaptureWithCompletion:].

Declared In

TVIAppScreenSource.h

– stopCapture

Stops capture asynchronously.

- (void)stopCapture

Discussion

This method is equivalent to calling [TVIAppScreenSource stopCaptureWithCompletion:] with a nil block.

Declared In

TVIAppScreenSource.h

– stopCaptureWithCompletion:

Stops capture asynchronously with a completion handler.

- (void)stopCaptureWithCompletion:(nullable TVIAppScreenSourceStoppedBlock)completion

Parameters

completion

A handler block to be called on the main queue once the RPScreenRecorder is stopped.

Discussion

Use this method to coordinate your application logic with the stopping of the source’s video pipeline.

Declared In

TVIAppScreenSource.h