Languages

Menu
Sites
Language
How to launch a back facing camera in native application

Hi,

I am following https://developer.tizen.org/fr/documentation/tutorials/native-application/multimedia/camera?langredirect=1 tutorial to launch rear camera in native application but unfortunately it is not working. Is there any other resource so that i can follow. I have created the camera handler properly and using those in create_base_gui function. But it is not working properly, Any help would be appriciated.

Thank you 

dihan

 

Responses

5 Replies
Jean Yang

Strange!!! Camere should be working correctly.

Did you add the camera privilege to manifest?

<privilege>http://tizen.org/privilege/camera</privilege>

Shahadat Hossain

Yes, I did give the privilege in manifest file. Can you share sample code snippet or an overview ?

Shahadat Hossain

I only need to initialize and preview the camera. I don't need other features like taking photo and focusing the camera. If you overview of the steps it would be help full.

daniel kim

Hi,

How about you refer to camera sample of IDE?  You can find 'Self Camera Sample Application' in Sample of Native project.

Below modification will run back side camera on your device.

 

main-view.c

static Eina_Bool _main_view_init_camera(main_view *view)
{
    int result = camera_create(CAMERA_DEVICE_CAMERA0, &view->camera);
    if (CAMERA_ERROR_NONE == result)
    {
        if (view->preview_canvas)
        {
            result = camera_set_display(view->camera, CAMERA_DISPLAY_TYPE_EVAS, GET_DISPLAY(view->preview_canvas));
            if (CAMERA_ERROR_NONE == result)
            {
                camera_set_display_mode(view->camera, CAMERA_DISPLAY_MODE_ORIGIN_SIZE);
              //  camera_set_display_flip(view->camera, CAMERA_FLIP_VERTICAL);
                camera_set_display_visible(view->camera, true);

                return _main_view_start_camera_preview(view->camera);
            }
        }
    }
    return !result;
}

 

 

Shahadat Hossain

It works now. Thanks for your support.