Class reference

CameraServer

Inherits Object

Server keeping track of different cameras accessible in Redot.

Description

The CameraServer keeps track of different cameras accessible in Redot. These are external cameras such as webcams or the cameras on your phone. It is notably used to provide AR modules with a video feed from the camera. Note: This class is currently only implemented on Linux, Android, macOS, and iOS. On other platforms no CameraFeeds will be available. To get a CameraFeed on iOS, the camera plugin from godot-ios-plugins is required.

Properties

bool monitoring_feeds = false

If true, the server is actively monitoring available camera feeds. This has a performance cost, so only set it to true when you're actively accessing the camera. Note: After setting it to true, you can receive updated camera feeds through the camera_feeds_updated signal.

			func _ready():
				CameraServer.camera_feeds_updated.connect(_on_camera_feeds_updated)
				CameraServer.monitoring_feeds = true

			func _on_camera_feeds_updated():
				var feeds = CameraServer.feeds()
			
			public override void _Ready()
			{
				CameraServer.CameraFeedsUpdated += OnCameraFeedsUpdated;
				CameraServer.MonitoringFeeds = true;
			}

			void OnCameraFeedsUpdated()
			{
				var feeds = CameraServer.Feeds();
			}
			

Methods

void add_feed(CameraFeed feed)

Adds the camera feed to the camera server.

CameraFeed[] feeds()

Returns an array of CameraFeeds.

int get_feed_count()

Returns the number of CameraFeeds registered.

void remove_feed(CameraFeed feed)

Removes the specified camera feed.

Signals

camera_feed_added(int id)

Emitted when a CameraFeed is added (e.g. a webcam is plugged in).

camera_feed_removed(int id)

Emitted when a CameraFeed is removed (e.g. a webcam is unplugged).

camera_feeds_updated()

Emitted when camera feeds are updated.

Constants

FEED_RGBA_IMAGE = 0

Enum: FeedImage

The RGBA camera image.

FEED_YCBCR_IMAGE = 0

Enum: FeedImage

The YCbCr camera image.

FEED_Y_IMAGE = 0

Enum: FeedImage

The Y component camera image.

FEED_CBCR_IMAGE = 1

Enum: FeedImage

The CbCr component camera image.

Source revision 4f5b14abade2
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.