Max Stolbinsky
Posts: 0
Joined: Fri Aug 23, 2013 9:09 pm

How to initialize instance of camera service to use camera itself or camera roll?

I need to give user 2 options in the app: use live camera or camera roll to get image. So I need setup proper sourcetype for service instance by JS before invoke it.

How can i do it? I mean what value should i pass there from JS? I have tried different, but non is working. Could you please advice what value should i assign to the sourcetype input parameter to initialize camera roll?

Thanks!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to initialize instance of camera service to use camera itself or camera roll?

Hello! In Camera service there is sourceType request parameter. Set this parameter. Here is more information http://cordova.apache.org/docs/en/2.9...

Max Stolbinsky
Posts: 0
Joined: Fri Aug 23, 2013 9:09 pm

How to initialize instance of camera service to use camera itself or camera roll?

well, i saw this document, but my question was how to pass proper settings to camera?

For example,
mobilecamera_camera is an instance of CameraService

I want to use stored images, so I try ti invoke it following way
mobilecamera_camera.execute({data:{sourcetype: 0}});

But instead of library it opens camera again,

What i'm doing wrong?

Thanks!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to initialize instance of camera service to use camera itself or camera roll?

Hi Max,

You can create one more Camera service, and specify another sourcetype in mapping, for example Saved photo album.

Max Stolbinsky
Posts: 0
Joined: Fri Aug 23, 2013 9:09 pm

How to initialize instance of camera service to use camera itself or camera roll?

I did this way too. It was 1-st i wanted to do :)
In this case if I select from Album in one instance - it selects same source too on another instance.... Kind confused...

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to initialize instance of camera service to use camera itself or camera roll?

Hello! Try with this code premobilecamera_camera.execute({
data: {
sourcetype: 'Saved photo album'
}
});/pre or this one premobilecamera_camera.execute({
data: {
sourcetype: 'Photolibrary'
}
});/pre
Please note according to documentation it gives the same result on Android.

Max Stolbinsky
Posts: 0
Joined: Fri Aug 23, 2013 9:09 pm

How to initialize instance of camera service to use camera itself or camera roll?

Thanks! It works now!
But would be honest - it is not obvious solution

Return to “Issues”