Description

LckStreamingController is a Unity MonoBehaviour that orchestrates the user streaming workflow in the LIV Capture Kit. It functions as a state machine, guiding the user through the necessary steps before streaming with LIV Hub:
  • Logging in to LIV Hub
  • Checking subscription status
  • Confirming correct stream configuration
This class serves as a reference implementation for a recommended streaming flow. Developers can:
  • Use it directly in their scene, or
  • Extend it to create custom UI/UX flows while maintaining best practices.
At runtime, it integrates with both:
  • ILckService - for starting/stopping streams
  • ILckCore - for authentication and user status checks
To use, attach LckStreamingController to a GameObject in your scene and assign its dependencies in the Unity Inspector.

Usage

  • Place LckStreamingController on a scene GameObject.
  • Connect a LckNotificationController for user-facing messages.
  • Wire UnityEvents (_onStreamButtonError, _onStreamButtonPressWithCorrectConfig) for feedback when users press the stream button.
  • Call StreamingButtonToggled() from your UI toggle or button to start/stop streaming once configured.
  • Call CheckCurrentState() when the user initiates the streaming setup flow.

Example

[SerializeField] private LckStreamingController _streamingController;

public void OnStreamButtonPressed()
{
    _streamingController.StreamingButtonToggled();
}

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.