Page 1 of 1

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

Posted: Mon Oct 21, 2013 1:29 pm
by Max Stolbinsky

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!


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

Posted: Mon Oct 21, 2013 2:06 pm
by Maryna Brodina

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


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

Posted: Mon Oct 21, 2013 7:11 pm
by Max Stolbinsky

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!


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

Posted: Mon Oct 21, 2013 9:39 pm
by Kateryna Grynko

Hi Max,

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


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

Posted: Mon Oct 21, 2013 9:43 pm
by Max Stolbinsky

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...


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

Posted: Tue Oct 22, 2013 7:50 am
by Maryna Brodina

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.


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

Posted: Tue Oct 22, 2013 10:52 am
by Max Stolbinsky

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