Skip to main content

Description

LckStreamingController is a Unity MonoBehaviour that guides users through the steps required before they can live stream with LIV Hub: logging in, verifying their subscription, and confirming stream configuration. It runs as a state machine that advances through each check automatically, then enables the stream toggle once everything is validated. This class is a reference implementation — you can use it directly or extend it to build custom UI/UX flows. At runtime it integrates with ILckService for starting/stopping streams and ILckCore for authentication and user status checks.

Usage

Use LckStreamingController to manage the full streaming setup flow. Attach it to a GameObject, connect a LckNotificationController for user messages, and wire your stream button to StreamingButtonToggled().
[SerializeField] private LckStreamingController _streamingController;

public void OnStreamButtonPressed()
{
    _streamingController.StreamingButtonToggled();
}
Call CheckCurrentState() when the user opens the streaming UI to kick off the validation state machine.

References

Properties

PropertyTypeDescription
IsConfiguredCorrectlyboolIndicates whether user setup and validation have been completed. When true, streaming can be toggled directly.
CurrentStateLckStreamingBaseStateThe currently active state in the streaming state machine.
CheckConfiguredStateLckStreamingCheckConfiguredStateState for verifying if the user has already configured streaming.
ShowCodeStateLckStreamingShowCodeStateState for showing the user their login code.
CheckSubscribedStateLckStreamingCheckSubscribedStateState for verifying if the user has an active subscription.
WaitingForConfigureStateLckStreamingWaitingForConfigureStateState for waiting while the user configures streaming in LIV Hub.
ConfiguredCorrectlyStateLckStreamingConfiguredCorrectlyStateState indicating setup is complete and the user can start streaming.
CancellationTokenSourceCancellationTokenSourceToken used to cancel any ongoing async tasks when switching states or destroying the object.
LckCoreILckCoreProvides access to the LIV Core SDK for authentication and user status checks.

Methods

MethodReturnsDescription
CheckCurrentState()voidStarts the setup/validation state machine from the beginning (CheckConfiguredState).
StopCheckingStates()voidCancels any ongoing async checks or polling in the current state. Useful when leaving the streaming UI.
SwitchState(LckStreamingBaseState state)voidSwitches to a new streaming state, cancelling pending operations and updating IsConfiguredCorrectly.
StreamingButtonToggled()voidToggles streaming: if configured, starts/stops streaming; if not configured, invokes _onStreamButtonError.
StopStreaming()voidForce stops streaming if a stream is currently active.
ShowNotification(NotificationType type)voidDisplays a notification via the linked LckNotificationController.
HideNotifications()voidHides currently visible notifications.
SetNotificationStreamCode(string code)voidUpdates the notification UI with a login/streaming code.
Log(string message)voidLogs debug messages if _showDebugLogs is enabled.
LogError(string error)voidLogs error messages if _showDebugLogs is enabled.

See Also

  • ILckService — Service interface used to start/stop streams
  • ILckCore — Core interface used for authentication and subscription checks
  • LckNotificationController — Displays login codes, errors, and configuration prompts during the flow
  • LckService — Default ILckService implementation with streaming methods