Skip to content

Commit

Permalink
Improve camera module.
Browse files Browse the repository at this point in the history
- Add value type for KeyCameraIsRecording.
- Fix camera connection handling.
  • Loading branch information
brunoga committed May 21, 2024
1 parent 7de3cb8 commit 4f54e6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions module/camera/camera.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func New(ub unitybridge.UnityBridge, l *logger.Logger,
return
}

if ok, connected := r.Value().(bool); ok && connected {
if connected, ok := r.Value().(*bool); ok && *connected {
l.Debug("** Camera connected **")
// Ask for video texture information.
if err := c.UB().SendEvent(event.NewFromType(
Expand All @@ -70,7 +70,7 @@ func New(ub unitybridge.UnityBridge, l *logger.Logger,
}
} else if !ok {
l.Debug("** Camera connection result value not a bool **")
} else if !connected {
} else if !*connected {
l.Debug("** Camera not connected **")
}
}, cm)
Expand Down
2 changes: 1 addition & 1 deletion unitybridge/unity/key/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var (
KeyCameraPhotoSize = newKey("KeyCameraPhotoSize", 16777221, AccessTypeRead|AccessTypeWrite, nil)
KeyCameraStartRecordVideo = newKey("KeyCameraStartRecordVideo", 16777222, AccessTypeAction, nil)
KeyCameraStopRecordVideo = newKey("KeyCameraStopRecordVideo", 16777223, AccessTypeAction, nil)
KeyCameraIsRecording = newKey("KeyCameraIsRecording", 16777224, AccessTypeRead, nil)
KeyCameraIsRecording = newKey("KeyCameraIsRecording", 16777224, AccessTypeRead, &value.Bool{})
KeyCameraCurrentRecordingTimeInSeconds = newKey("KeyCameraCurrentRecordingTimeInSeconds", 16777225, AccessTypeRead, nil)
KeyCameraVideoFormat = newKey("KeyCameraVideoFormat", 16777226, AccessTypeRead|AccessTypeWrite, nil)
KeyCameraMode = newKey("KeyCameraMode", 16777227, AccessTypeRead|AccessTypeWrite, nil)
Expand Down

0 comments on commit 4f54e6b

Please sign in to comment.