]>
git.proxmox.com Git - sencha-touch.git/blob - src/src/device/camera/Cordova.js
4 Ext
.define('Ext.device.camera.Cordova', {
5 alternateClassName
: 'Ext.device.camera.PhoneGap',
6 extend
: 'Ext.device.camera.Abstract',
8 getPicture: function (onSuccess
, onError
, options
){
10 navigator
.camera
.getPicture(onSuccess
, onError
, options
);
16 cleanup: function(onSuccess
, onError
) {
18 navigator
.camera
.cleanup(onSuccess
, onError
);
24 capture: function(args
) {
25 var onSuccess
= args
.success
,
26 onError
= args
.failure
,
28 sources
= this.source
,
29 destinations
= this.destination
,
30 encodings
= this.encoding
,
32 destination
= args
.destination
,
33 encoding
= args
.encoding
,
37 onSuccess
= Ext
.Function
.bind(onSuccess
, scope
);
38 onError
= Ext
.Function
.bind(onError
, scope
);
41 if (source
!== undefined) {
42 options
.sourceType
= sources
.hasOwnProperty(source
) ? sources
[source
] : source
;
45 if (destination
!== undefined) {
46 options
.destinationType
= destinations
.hasOwnProperty(destination
) ? destinations
[destination
] : destination
;
49 if (encoding
!== undefined) {
50 options
.encodingType
= encodings
.hasOwnProperty(encoding
) ? encodings
[encoding
] : encoding
;
53 if ('quality' in args
) {
54 options
.quality
= args
.quality
;
57 if ('width' in args
) {
58 options
.targetWidth
= args
.width
;
61 if ('height' in args
) {
62 options
.targetHeight
= args
.height
;
65 this.getPicture(onSuccess
, onError
, options
);