Index · Object → CameraServer

CameraServer

Server keeping track of different cameras accessible in Godot.

Class Description

The CameraServer keeps track of different cameras accessible in Godot. 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, enable EditorExportPlatformIOS.modules/camera.

Properties

var monitoring_feeds: bool = 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()

Methods

func add_feed(feed: CameraFeed) -> void

Adds the camera feed to the camera server.

func feeds() -> CameraFeed[]

Returns an array of CameraFeeds.

func get_feed(index: int) -> CameraFeed

Returns the CameraFeed corresponding to the camera with the given index.

func get_feed_count() -> int

Returns the number of CameraFeeds registered.

func remove_feed(feed: CameraFeed) -> void

Removes the specified camera feed.

Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

signal camera_feed_added(id: int)

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

signal camera_feed_removed(id: int)

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

signal camera_feeds_updated()

Emitted when camera feeds are updated.

Inherited from Object (2)

Enums & Constants

enum FeedImage
FEED_RGBA_IMAGE = 0

The RGBA camera image.

FEED_YCBCR_IMAGE = 0

The YCbCr camera image.

FEED_Y_IMAGE = 0

The Y component camera image.

FEED_CBCR_IMAGE = 1

The CbCr component camera image.