Subscribing to a video that is unavailable

The application tries to subscribe to a video when isAvailable is false.

Subscribing a video in this case results in failure.

This error is expected from SDK's perspective as applications shouldn't subscribe to a video that is currently not available.

How to detect using the SDK

If you subscribe to a video that is unavailable, the createView API throws an error.

error Details
code 412 (Precondition Failed)
subcode 43200
message Failed to create view, remote stream is not available
resultCategories Expected

How to mitigate or resolve

While the SDK throws an error in this scenario, applications should refrain from subscribing to a video when the remote video isn't available, as it doesn't satisfy the precondition.

The recommended practice is to monitor the isAvailable change within the isAvailable event callback function and to subscribe to the video when isAvailable changes to true. However, if there's asynchronous processing in the application layer, that might cause some delay before invoking createView API. In such case, applications can check isAvailable again before invoking the createView API.