Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cameracontrol #3354

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Cameracontrol #3354

wants to merge 2 commits into from

Conversation

ndonkoHenri
Copy link
Collaborator

@ndonkoHenri ndonkoHenri commented May 25, 2024

Closes #1281

Test Code

import flet as ft


def main(page: ft.Page):
    page.window_always_on_top = True
    page.theme_mode = ft.ThemeMode.LIGHT
    page.horizontal_alignment = ft.CrossAxisAlignment.CENTER

    page.add(
        cam := ft.Camera(
            width=350,
            height=350,
            resolution_preset=ft.ResolutionPreset.MAX,
            error_content=ft.ProgressRing(),
            exposure_offset=0,
            exposure_mode=ft.ExposureMode.AUTO,
            image_format_group=ft.ImageFormatGroup.JPEG,
            zoom_level=3,
        ),
        ft.ElevatedButton("Capture Image", on_click=lambda _: cam.capture_image()),
        ft.ElevatedButton("Start Video Recording", on_click=lambda _: cam.start_video_recording()),
        ft.ElevatedButton("Stop Video Recording", on_click=lambda _: cam.stop_video_recording()),
    )


ft.app(target=main)

Notes

Control not showing up as expected atm.
We need to find a better way to pass the list available cameras (which is to be run before calling runApp) to the CameraControl in flet_camera package.
Ref: Docs

# Conflicts:
#	client/ios/Runner/Info.plist
#	client/lib/main.dart
#	client/pubspec.lock
@Muddassirofficial
Copy link

await asyncio.get_running_loop().run_in_executor(
File "C:\Users\Muddassir Farooq\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\Muddassir Farooq\Desktop\Python Projects\Flet Projects\Ambassadors\test.py", line 10, in main
cam := ft.Camera(
^^^^^^^^^
AttributeError: module 'flet' has no attribute 'Camera'

@Kacper-OS
Copy link
Contributor

await asyncio.get_running_loop().run_in_executor( File "C:\Users\Muddassir Farooq\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\Muddassir Farooq\Desktop\Python Projects\Flet Projects\Ambassadors\test.py", line 10, in main cam := ft.Camera( ^^^^^^^^^ AttributeError: module 'flet' has no attribute 'Camera'

It wasn't merged yet

@deviagomendes
Copy link

By when, more or less, will this camera functionality be implemented? I need it urgently!

@ndonkoHenri
Copy link
Collaborator Author

No ETA for now, please be patient.

@deviagomendes
Copy link

deviagomendes commented Jun 20, 2024

While the functionality is not officially launched, could you help me call it in some way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Camera control
4 participants