Skip to content

j20001970/godot-cameraserver-extension

Repository files navigation

CameraServerExtension

CameraServerExtension is a Godot 4.4+ plugin that extends the support of original CameraServer to multiple platforms.

Usage

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())

Support Status

Platform Backend Formats Notes
Android Camera2 (CPU-based)
  • JPEG
Linux PipeWire
  • YUY2
  • YVYU
  • UYVY
  • VYUY
iOS AVFoundation
  • RGBA
macOS -
Windows Media Foundation
  • YUY2
  • NV12
  • MJPG
Web - -

Known Issues

  • Avoid upcasting CameraFeedExtension to CameraFeed, otherwise get_formats and set_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
  • Since Godot v4.5, CameraServerExtension requires setting CameraServer.monitoring_feeds to true before instantiation to provide custom feeds.

About

Godot GDExtension plugin that extend CameraServer support to multiple platforms.

Topics

Resources

License

Stars

Watchers

Forks

Contributors