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:
var _on_permission_result = func(granted: bool) -> void:
if not granted:
print("Camera access permission not granted")
return
camera_extension.permission_result.connect(_on_permission_result)
camera_extension.request_permission()
# Check new camera feeds
print(CameraServer.feeds())| Platform | Backend | Formats | Notes |
|---|---|---|---|
| Android | Camera2 (CPU-based) |
|
|
| Linux | PipeWire |
|
|
| iOS | AVFoundation |
|
|
| macOS | - | ||
| Windows | Media Foundation |
|
|
| Web | - | - |
|
- Avoid upcasting
CameraFeedExtensiontoCameraFeed, otherwiseget_formatsandset_formatwill 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- Since Godot v4.5, CameraServerExtension requires setting
CameraServer.monitoring_feedstotruebefore instantiation to provide custom feeds.