Skip to content

A Godot plugin that provides a unified camera capture interface for Android and iOS using native platform APIs.

License

Notifications You must be signed in to change notification settings

godot-mobile-plugins/godot-native-camera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

      


Godot Native Camera Plugin

A Godot plugin that provides a unified camera capture interface for Android and iOS using native platform APIs. It enables real‑time camera frame streaming directly into Godot with configurable resolution, rotation, frame skipping, and optional grayscale output.

Key Features:

  • Unified GDScript API for Android and iOS
  • Enumerate available cameras and their supported output sizes
  • Start and stop native camera frame streaming
  • Receive raw frame buffers or ready‑to‑use Image objects
  • Configurable resolution, rotation, frame skipping, and grayscale capture
  • Designed for real‑time use cases (CV, AR preprocessing, custom rendering)

Table of Contents


Installation

Before installing this plugin, make sure to uninstall any previous versions of the same plugin.

If installing both Android and iOS versions of the plugin in the same project, ensure that both versions use the same addon interface version.

There are two ways to install the NativeCamera plugin into your project:

  • Through the Godot Editor AssetLib
  • Manually by downloading archives from GitHub

Installing via AssetLib

Steps:

  • Search for NativeCamera in the Godot Editor AssetLib

  • Click Download

  • In the installation dialog:

    • Keep Change Install Folder set to your project root
    • Keep Ignore asset root checked
    • Click Install
  • Enable the plugin from Project → Project Settings → Plugins

Installing both Android and iOS versions

When installing both platforms via AssetLib, Godot may warn that some files conflict and will not be installed. This is expected and safe to ignore, as both platforms share the same addon interface code.

Installing manually

Steps:

  • Download the release archive from GitHub
  • Unzip the archive
  • Copy the contents into your Godot project root
  • Enable the plugin via Project → Project Settings → Plugins

Usage

Add a NativeCamera node to your main scene or register it as an autoload (singleton).

Typical workflow:

  1. Query available cameras using get_cameras()
  2. Choose a camera and desired output size
  3. Create a FeedRequest to configure the stream
  4. Start the camera feed
  5. Receive frames via signals

Example

@onready var camera := $NativeCamera

func _ready():
	camera.permission_result.connect(_on_permission_result)
	camera.frame_available.connect(_on_frame_available)
	camera.request_permission()

func _on_permission_result(granted: bool) -> void:
	if not granted:
		push_error("Camera permission denied")
		return

	var cameras := camera.get_cameras()
	if cameras.is_empty():
		return

	var cam: CameraInfo = cameras[0]
	var request := FeedRequest.new()
		.set_camera_id(cam.get_camera_id())
		.set_width(1280)
		.set_height(720)
		.set_rotation(90)
		.set_grayscale(false)

	camera.start_feed(request)

func _on_frame_available(frame: FrameInfo) -> void:
	var img := frame.get_image()
	# Use the image or raw buffer here

Signals

Register listeners on the NativeCamera node:

  • permission_result(granted: bool)

    • Emitted after a camera permission request completes
  • frame_available(frame: FrameInfo)

    • Emitted when a new camera frame is available

Methods

  • request_permission()

    • Requests camera permission from the OS
  • get_cameras() -> Array[CameraInfo]

    • Returns a list of available cameras
  • start(request: FeedRequest)

    • Starts the camera feed with the given configuration
  • stop()

    • Stops the active camera feed

Classes

CameraInfo

Encapsulates camera metadata provided by the mobile OS.

Properties / Methods:

  • get_camera_id() -> String
  • is_front_facing() -> bool
  • get_output_sizes() -> Array[FrameSize]

FeedRequest

Defines configuration parameters for starting a camera feed.

Configurable options:

  • Camera ID
  • Output width and height
  • Frames to skip (performance tuning)
  • Rotation (degrees)
  • Grayscale capture

Supports fluent chaining via setter methods.


FrameInfo

Represents a single captured frame.

Accessors:

  • get_buffer() -> PackedByteArray
  • get_width() -> int
  • get_height() -> int
  • get_rotation() -> int
  • is_grayscale() -> bool
  • get_image() -> Image

FrameSize

Represents a supported camera output resolution.

Accessors:

  • get_width() -> int
  • get_height() -> int
  • get_raw_data() -> Dictionary

Platform-Specific Notes

Android

  • Ensure Android export templates are installed
  • Enable Gradle build in export settings
  • Camera permission is required at runtime

Troubleshooting:

  • Logs (Linux/macOS): adb logcat | grep godot
  • Logs (Windows): adb.exe logcat | select-string "godot"

Helpful resources:

  • Godot Android export documentation
  • Android Studio & ADB documentation

iOS

  • Follow Godot’s iOS export instructions
  • Camera permission must be declared in the generated Xcode project
  • Use Xcode console logs for debugging

Links


All Plugins

Plugin Android iOS Free Open Source License
Notification Scheduler MIT
Admob MIT
Deeplink MIT
Share MIT
In-App Review MIT
Native Camera MIT
OAuth 2.0 MIT
QR MIT

Credits

Developed by Cengiz

Original repository: Godot Native Camera Plugin


Contributing

Contributions are welcome. Please see the contributing guide in the repository for details.

About

A Godot plugin that provides a unified camera capture interface for Android and iOS using native platform APIs.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published