Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/classes/CameraFeed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<description>
A camera feed gives you access to a single physical camera attached to your device. When enabled, Godot will start capturing frames from the camera which can then be used. See also [CameraServer].
[b]Note:[/b] Many cameras will return YCbCr images which are split into two textures and need to be combined in a shader. Godot does this automatically for you if you set the environment to show the camera image in the background.
[b]Note:[/b] This class is currently only implemented on Linux, Android, macOS, and iOS. On other platforms no [CameraFeed]s will be available. To get a [CameraFeed] on iOS, the camera plugin from [url=https://github.com/godotengine/godot-ios-plugins]godot-ios-plugins[/url] is required.
[b]Note:[/b] This class is currently only implemented on Linux, Android, macOS, and iOS. On other platforms no [CameraFeed]s will be available.
</description>
<tutorials>
</tutorials>
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/CameraServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<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.
[b]Note:[/b] This class is currently only implemented on Linux, Android, macOS, and iOS. On other platforms no [CameraFeed]s will be available. To get a [CameraFeed] on iOS, the camera plugin from [url=https://github.com/godotengine/godot-ios-plugins]godot-ios-plugins[/url] is required.
[b]Note:[/b] This class is currently only implemented on Linux, Android, macOS, and iOS. On other platforms no [CameraFeed]s will be available.
</description>
<tutorials>
</tutorials>
Expand Down
4 changes: 2 additions & 2 deletions modules/camera/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Import("env_modules")

env_camera = env_modules.Clone()

if env["platform"] in ["windows", "macos", "linuxbsd", "android"]:
if env["platform"] in ["windows", "macos", "linuxbsd", "android", "ios"]:
env_camera.add_source_files(env.modules_sources, "register_types.cpp")

if env["platform"] == "windows":
env_camera.add_source_files(env.modules_sources, "camera_win.cpp")

elif env["platform"] == "macos":
elif env["platform"] in ["macos", "ios"]:
env_camera.add_source_files(env.modules_sources, "camera_macos.mm")

elif env["platform"] == "android":
Expand Down
8 changes: 6 additions & 2 deletions modules/camera/camera_macos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,14 @@ - (void)dealloc {
if (@available(macOS 10.15, *)) {
#endif
AVCaptureDeviceDiscoverySession *session;
if (@available(macOS 14.0, *)) {
if (@available(macOS 14.0, iOS 17.0, *)) {
session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternal, AVCaptureDeviceTypeBuiltInWideAngleCamera, AVCaptureDeviceTypeContinuityCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
} else {
session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternalUnknown, AVCaptureDeviceTypeBuiltInWideAngleCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeBuiltInWideAngleCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
#else
session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternalUnknown, AVCaptureDeviceTypeBuiltInWideAngleCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
#endif
}
devices = session.devices;
#if defined(__x86_64__)
Expand Down
2 changes: 1 addition & 1 deletion modules/camera/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def can_build(env, platform):

if sys.platform.startswith("freebsd") or sys.platform.startswith("openbsd"):
return False
return platform == "macos" or platform == "windows" or platform == "linuxbsd" or platform == "android"
return platform in ["macos", "windows", "linuxbsd", "android", "ios"]


def configure(env):
Expand Down
4 changes: 2 additions & 2 deletions modules/camera/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#if defined(WINDOWS_ENABLED)
#include "camera_win.h"
#endif
#if defined(MACOS_ENABLED)
#if defined(MACOS_ENABLED) || defined(IOS_ENABLED)
#include "camera_macos.h"
#endif
#if defined(ANDROID_ENABLED)
Expand All @@ -54,7 +54,7 @@ void initialize_camera_module(ModuleInitializationLevel p_level) {
#if defined(WINDOWS_ENABLED)
CameraServer::make_default<CameraWindows>();
#endif
#if defined(MACOS_ENABLED)
#if defined(MACOS_ENABLED) || defined(IOS_ENABLED)
CameraServer::make_default<CameraMacOS>();
#endif
#if defined(ANDROID_ENABLED)
Expand Down
Loading