CameraServerExtension is a Godot 4.4+ plugin that extends the support of original CameraServer to multiple platforms.
CameraServerExtension
class will be available to Godot once the plugin is loaded, after creating a CameraServerExtension
instance, it can be used for checking camera access permission and making permission request, newly created CameraFeedExtension
can be found in CameraServer
.
var camera_extension := CameraServerExtension.new()
# Check camera permission
if camera_extension.permission_granted():
# All good
pass
else:
camera_extension.request_permission()
# Check new camera feeds
print(CameraServer.feeds())
Platform | Backend | Formats | Notes |
---|---|---|---|
Android | Camera2 (CPU-based) |
|
- |
Linux | PipeWire |
|
- |
iOS | AVFoundation | - | Untested |
macOS | - | ||
Windows | Media Foundation |
|
- |
Web | - | - | - |
- Avoid upcasting
CameraFeedExtension
toCameraFeed
, otherwiseget_formats
andset_format
will not work.
var feed := CameraServer.get_feed(0) # Returned feed will not work if it is CameraFeedExtension
var feed: CameraFeed = CameraServer.get_feed(0) # Same as above
var feed = CameraServer.get_feed(0) # Both CameraFeed and CameraFeedExtension will work