Conversation
32d07e5 to
d7aa707
Compare
d7aa707 to
31daada
Compare
There was a problem hiding this comment.
Note that the demo requires 4.5 (even on unsupported platforms), as it references the monitoring_feeds property which doesn't exist on 4.4.1. This is not essential to fix to merge (it's fine for this demo to be 4.5+), but I thought I'd mention nonetheless.
Some feedback:
- The demo should be switched to the Compatibility rendering method if it doesn't use features exclusive to Forward+/Mobile.
- The demo's folder should be renamed from
camerafeedtocamera_feed. application/run/low_processor_modeshould be enabled in the Project Settings to reduce CPU/GPU utilization when idle.
95f148b to
7c11b39
Compare
|
@Calinou
|
|
The demo should use a lower window size on desktop platforms. Otherwise, on a 1080p display, it'll look like this when run from the editor with game window embedding enabled: You can do this by changing Window Width Override and Window Height Override to |
7c11b39 to
c48aa42
Compare
|
bea0171 to
aea91ff
Compare
aea91ff to
292547b
Compare
292547b to
91e9758
Compare
|
@AThousandShips Address review comments. |
5d13712 to
0e376f2
Compare
|
I've tested the demo on macOS with 4.5.stable and I noticed that while the camera name appears, I can't choose any format:
After clicking Reload, I see a permission prompt. When I accept it, the LED next to the webcam lights up, but I still don't see anything. I don't see any errors in the terminal. This occurs regardless of how I'm running Godot (it's the official 4.5 .app bundle, I've tried running it from a terminal but also from Spotlight). Maybe I'm missing an entitlement? cc @bruvzg |
|
@Calinou |
|
Current entitlements should be fine, but if you are using multiple bundles with the same id at the same (and all versions of Godot have the same id) permission can sometimes stop working. Removing it from the allowed app list in the system settings (minus button) completly and restarting the app should fix it. |
|
Thank you for this demo, I've added the "waiting for Godot" label because I think it's probably worth waiting for more platforms to have camera feeds supported in the engine's code before merging, otherwise users will get confused and/or annoyed wondering why it doesn't work. |
|
Godot4.5 stable was released, can merge this demo now? |
As seen in OP, pull requests for Windows, iOS and Web support have yet to be merged. I'd wait until the Windows PR is merged at least, as well as the PR that fixes issues in the current macOS implementation. |
e164004 to
ac8f979
Compare
350b34c to
eea86a2
Compare
|
|
||
| # Request camera permission on Android | ||
| if OS.get_name() == "Android": | ||
| if not "CAMERA" in OS.get_granted_permissions(): |
There was a problem hiding this comment.
| if not "CAMERA" in OS.get_granted_permissions(): | |
| if "CAMERA" not in OS.get_granted_permissions(): |
There was a problem hiding this comment.
Android permissions - and our current API for them - are... awkward beasts. I attempted to clarify the docs on them a while back, but basically it just flagged the API as a legacy problem. godotengine/godot#105364
TL;DR "CAMERA" not in OS.get_granted_permissions() will always return true. The string needs to be "android.permission.CAMERA". Technically, request_permission is also documented as requiring the full permission... but because of a bug (or implementation) it currently passes without. 🤷
All that said, this approach itself - which does give us a great little demo in general! - excludes the ability to use one-click deploy under Android; given the perms will always be wiped and there's no time given for the user to accept them. I would recommend also switching the logic to leverage something like
if OS.get_name() == "Android":
if "android.permission.CAMERA" not in OS.get_granted_permissions():
OS.request_permission("android.permission.CAMERA")
var signaled_result = await get_tree().on_request_permissions_result
assert(signaled_result[1] == true, "CAMERA permission not granted. Bailing out.")
It's a little janky - it should really be a loop in case some other permission is requested / granted first - but solid enough here for the demo purposes... under the current permissions API constraints. (IMO it's super-important that we try keep content like the demos approachable / accessible so as not to scare off folks new to the features or platform.)
There was a problem hiding this comment.
Thanks for the detailed feedback! You're absolutely right about the permission handling issues.
I've updated the implementation with the following changes:
- Fixed permission string: Now using "android.permission.CAMERA" for get_granted_permissions() check
- Added permission request UI: Instead of silently failing, the app now shows a dedicated permission panel with a "Grant Permission" button
- Proper async handling: Using await get_tree().on_request_permissions_result with a loop to handle cases where other permissions might be signaled first:
This should work properly with one-click deploy now, as the user is given time to accept the permission before the camera initialization proceeds.
b49156b to
d5f8df5
Compare
Co-authored-by: Jason Kuo <j20001970@gmail.com>
d5f8df5 to
468fe06
Compare



This is a demo project for camera feed and camera server.
Supported Platforms
Limitations
Pull requests have been proposed for Windows, Web and iOS.
Add CameraFeed support for Windows godot#105476Add CameraFeed support for Windows godot#108538
Add CameraFeed support for Web godot#106784
[iOS] Reintegrate camera module to the main repo. godot#115502
Add CameraFeed support for iOS godot#106305iOS requires camera permission during App Store submission if any camera-related code exists in the binary, so this won't be merged into the Godot main repository.
Add Godot 4.x camera module support with display rotation and CameraFeed formats godot-sdk-integrations/godot-ios-plugins#89
An alternative implementation using PipeWire for Linux.
macOS is incomplete due to bugs.
Linux is incomplete due to bugs.
Preview