StreamProtectClient

public interface StreamProtectClient implements HasApiKey<Api.ApiOptions.NoOptions>

This interface is deprecated.
The Stream Protect API will be shutdown in 2023.

Stream Protect client that handles API calls.

When a client app starts a streaming session, it first enables Stream Protect by calling enable(StreamProtectOptions, OnStreamProtectEventListener). For every new video frame arrived in this session, the app passes the frame info by calling submitFrameInfo(FrameInfo). When this session ends, the app stops Stream Protect by calling disable().

Only one instance of Stream Protect is allowed to be enabled. The client app using Stream Protect must be an active, foreground app under WiFi connectivity. If the app is put into background, the connectivity is no longer via a WiFi network, or no frames are received, Stream Protect will stop on its own. The client app can use OnStreamProtectEventListener to be notified of any relevant StreamProtectEvent (like when and why it stopped) so that Stream Protect can be re-enabled accordingly.

Stream Protect considers enable-disable as one single session, so updating StreamProtectOptions or OnStreamProtectEventListener is not allowed in the middle of a session. The client app must call disable() first before changing the option or callback function.

Public Method Summary

abstract Task<Void>
disable()
This method is deprecated. The Stream Protect API will be shutdown in 2023.
abstract Task<Boolean>
enable(StreamProtectOptions options, OnStreamProtectEventListener listener)
This method is deprecated. The Stream Protect API will be shutdown in 2023.
abstract Task<Boolean>
isFeatureSupported()
This method is deprecated. The Stream Protect API will be shutdown in 2023.
abstract Task<Void>
submitFrameInfo(FrameInfo frameInfo)
This method is deprecated. The Stream Protect API will be shutdown in 2023.

Public Methods

public abstract Task<Void> disable ()

This method is deprecated.
The Stream Protect API will be shutdown in 2023.

Disables/stops Stream Protect when the current session ends.

If Stream Protect is not enabled or has already stopped, it returns a Task with FeatureNotEnabledException.

public abstract Task<Boolean> enable (StreamProtectOptions options, OnStreamProtectEventListener listener)

This method is deprecated.
The Stream Protect API will be shutdown in 2023.

Enables Stream Protect for a streaming session.

It returns true if the device is on WiFi, the app is in the foreground, and the feature is supported and initialized successfully. So it should be called when a streaming session starts and the app is in the foreground.

When enabled, StreamProtectOptions and OnStreamProtectEventListener will not be updated. To update, Stream Protect must be disabled first to indicate a session is finished. Otherwise Task reports IllegalStateException.

Note the protection will be auto-disabled if Stream Protect does not receive any video frames via submitFrameInfo(FrameInfo) for a long time. If disabled, it will not re-enable by itself.

If Stream Protect is not supported, Task reports FeatureNotSupportedException.

Parameters
options See StreamProtectOptions for detailed options.
listener Callback to listen for a StreamProtectEvent via OnStreamProtectEventListener. Set to null if not using callbacks.
Returns
  • Task that reports if Stream Protect is enabled.

public abstract Task<Boolean> isFeatureSupported ()

This method is deprecated.
The Stream Protect API will be shutdown in 2023.

Returns whether the current device supports Stream Protect.

Stream Protect requires firmware support of the device. Currently it is only supported on Google Chromecast with Google TV. This method does not check runtime conditions like WiFi connectivity or whether the app is running in the foreground.

public abstract Task<Void> submitFrameInfo (FrameInfo frameInfo)

This method is deprecated.
The Stream Protect API will be shutdown in 2023.

Informs Stream Protect a newly arrived frame using FrameInfo.

For best performance, this function is expected to be called as soon as every video frame is received. Stream Protect will auto-disable itself if it does not receive a new frame within several seconds, or if it does not receive an initial frame after enable(StreamProtectOptions, OnStreamProtectEventListener) is called for a long time.

If Stream Protect is not enabled or has already stopped, it returns a Task with FeatureNotEnabledException.