Module: LCKTablet | Type: UObject
Description
ULCKService is the central entry point for interacting with the LCK SDK at runtime. It provides APIs for:
- Starting and stopping recording
- Configuring capture settings (resolution, framerate, bitrate)
- Managing audio capture
- Controlling camera modes
- Taking photos
Accessing the Service
Via World Subsystem
ULCKSubsystem* Subsystem = GetWorld()->GetSubsystem<ULCKSubsystem>();
if (Subsystem)
{
ULCKService* Service = Subsystem->GetService();
// Use service...
}
Blueprint Access
UFUNCTION(BlueprintCallable, Category = "LCK")
ULCKService* GetLCKService()
{
if (UWorld* World = GetWorld())
{
if (ULCKSubsystem* Subsystem = World->GetSubsystem<ULCKSubsystem>())
{
return Subsystem->GetService();
}
}
return nullptr;
}
Recording State Tracking
ULCKService does not expose recording state delegates directly.
Use ULCKTabletDataModel events for state change notifications.
Via ULCKTabletDataModel
The recommended way to track recording state is through the tablet data model:
void UMyComponent::BeginPlay()
{
Super::BeginPlay();
// Get the tablet and its data model
if (ALCKTablet* Tablet = FindLCKTablet())
{
ULCKTabletDataModel* DataModel = Tablet->GetDataModel();
// Subscribe to recording state changes
DataModel->OnRecordingStateChanged.AddDynamic(
this, &UMyComponent::HandleRecordingStateChanged
);
}
}
void UMyComponent::HandleRecordingStateChanged(ELCKRecordingState NewState)
{
switch (NewState)
{
case ELCKRecordingState::Recording:
// Recording started
break;
case ELCKRecordingState::Saving:
// Recording stopped, saving file
break;
case ELCKRecordingState::Idle:
// Ready for new recording
break;
}
}
Available Data Model Events
| Event | Type | Description |
|---|
OnRecordingStateChanged | FOnRecordingStateChanged | Recording state changed |
OnCameraModeChanged | FOnCameraModeChanged | Camera mode changed |
OnMicStateChanged | FOnMicStateChanged | Microphone state changed |
OnQualityChanged | FOnQualityChanged | Quality profile changed |
Recording Methods
StartRecording / StopRecording
// Synchronous start
bool bSuccess = Service->StartRecording();
// Synchronous stop
bool bSuccess = Service->StopRecording();
Async Recording (Recommended)
// Start recording with callback
Service->StartRecordingAsync(FOnLCKRecorderBoolResult::CreateLambda([](bool bSuccess)
{
if (bSuccess)
{
// Recording started
}
}));
// Stop recording with progress callback
Service->StopRecordingAsync(
FOnLCKRecorderBoolResult::CreateLambda([](bool bSuccess)
{
// Recording stopped and saved
}),
FOnLCKRecorderProgress::CreateLambda([](float Progress)
{
// Update progress bar (0.0 - 1.0)
})
);
Query Recording State
bool bIsRecording = Service->IsRecording();
float Duration = Service->GetRecordingDuration();
Photo Capture
// Take a single photo
Service->TakePhoto();
// Photo saved notification via delegate
Service->OnPhotoSaved.AddLambda([](const FString& PhotoPath)
{
UE_LOG(LogTemp, Log, TEXT("Photo saved: %s"), *PhotoPath);
});
Preview Mode
Preview mode shows the camera output without recording.
// Start preview
Service->StartPreview();
// Stop preview
Service->StopPreview();
// Check if preview is active
bool bPreviewing = Service->IsPreviewActive();
Configuration Methods
Most configuration methods can only be called when NOT recording.
Check IsRecording() before changing settings.
Set Quality Profile
Service->SetQualityProfile(ELCKVideoQuality::HD);
Set Orientation
Service->SetOrientation(ELCKScreenOrientation::Landscape);
Set Camera Mode
Service->SetCameraMode(ELCKCameraMode::Selfie);
Service->SetCameraMode(ELCKCameraMode::FirstPerson);
Service->SetCameraMode(ELCKCameraMode::ThirdPerson);
Audio Control
Microphone
// Enable/disable microphone
Service->SetMicrophoneEnabled(true);
// Get current microphone volume level (0.0 - 1.0)
float MicLevel = Service->GetMicrophoneVolume();
Game Audio
// Enable/disable game audio capture
Service->SetGameAudioEnabled(true);
Complete Example
UCLASS()
class URecordingManager : public UActorComponent
{
GENERATED_BODY()
public:
void StartRecording()
{
ULCKService* Service = GetLCKService();
if (!Service)
{
UE_LOG(LogTemp, Error, TEXT("LCK Service not available"));
return;
}
if (Service->IsRecording())
{
UE_LOG(LogTemp, Warning, TEXT("Already recording"));
return;
}
Service->StartRecordingAsync(
FOnLCKRecorderBoolResult::CreateLambda([this](bool bSuccess)
{
if (bSuccess)
{
OnRecordingStarted();
}
else
{
OnRecordingFailed();
}
})
);
}
void StopRecording()
{
ULCKService* Service = GetLCKService();
if (!Service || !Service->IsRecording())
{
return;
}
Service->StopRecordingAsync(
FOnLCKRecorderBoolResult::CreateLambda([this](bool bSuccess)
{
OnRecordingStopped(bSuccess);
}),
FOnLCKRecorderProgress::CreateLambda([this](float Progress)
{
OnSaveProgress(Progress);
})
);
}
private:
ULCKService* GetLCKService()
{
if (UWorld* World = GetWorld())
{
if (ULCKSubsystem* Subsystem = World->GetSubsystem<ULCKSubsystem>())
{
return Subsystem->GetService();
}
}
return nullptr;
}
void OnRecordingStarted() { /* Update UI */ }
void OnRecordingFailed() { /* Show error */ }
void OnRecordingStopped(bool bSuccess) { /* Handle completion */ }
void OnSaveProgress(float Progress) { /* Update progress bar */ }
};
See Also