...
phenix.SDK.init({telemetryLevel: 'All', consoleLoggingLevel: 'Off'});
Channel States
Detecting the state using WebSDKv2 is similar to WebSDKv1. There is an RX observable that you can list for updates to the state and act accordingly:
channel.state.subscribe(state => const stateName = phenix.ChannelState[state])
phenix.ChannelState[state] will map to a string such as "Error", "Playing", or "Unauthorized".
Current channel states are listed below. Be sure to reference the string, not the enum number as that is subject to change if the list is re-ordered in a future update.
Offline
Starting
Paused
Playing
Recovering
StandBy
Stopped
Unauthorized
GeoRestricted
GeoBlocked
Error
Use the channel.state.subscribe for detecting Phenix playback failure.
ChannelState values that should cause a client to fall back to HLS:
Fallback immediately on
Offline
Stopped
Unauthorized
GeoRestricted
GeoBlocked
Fallback on Error when failureCount > 3
This can be achieved by evaluating the failure count whenever the state changes to Error (we expose the failure count). On each retry the state changes to Starting.
All errors are retried and some may resolve after 1 retry (we have a fallback strategy). It may also take 2-3 in case the channel is HA and it can fall over to another stream as well.
Error Management
Error handling is different when using WebSDK2.0 as some of the errors result from the token rather than from API calls such as joinChannel
.
...