Adobe DPS - Reading SDK 2.32

Class adobeDPS-CameraService

Extends:
adobeDPS-CameraService -> adobeDPS-Service -> adobeDPS-Class
Platforms:
iOS

A class for accessing the camera/photo library of the device. This class can be used to create a custom camera with an overlay image over the native camera. This class will be only part of the Adobe Reading API.

General Usage Notes

1.CameraService.initializePermissions() should be called from "AdobeDPS.initializationComplete.addOnce" as a best practice to ensure permissions are requested before getPicture is called

2. png is the only recommended and supported image format for the portraitOverlayImage and landscapeOverlayImage

3. When an overlay images is provided, the resulting picture's dimensions will be the same as the dimensions of the overlay image. The images are merged to fit to the aspect ratio.

4. When only one overlay image is provided, the Camera overlay is locked to that orientation. If the image is taken in the other orientation, the resulting image is rotated and fit to aspect ratio

5. when a picture is taken, A preview of the selected photo is shown. No overlay is seen on top of preview. But the final image returned will have the overlay. The saved image in the camera roll will also have the overlay

6. For iPhone and iPod Touch devices, the preview displays incorrect orientation of the photo when a picture is clicked in landscape orientation

7. When the initializePermissions is called for the first time, A dialog pops up asking permission to access the photos. If the permission was denied, the user will have the capability to change it in privacy settings.




Accessible from adobeDPS.cameraService

Constructor

adobeDPS-CameraService()
[inner] Create an instance of the CameraService.

Static Fields

Field Defined By
adobeDPS-CameraService.instance
The singleton of the CameraService.
CameraService

Fields

Field Defined By
These are the supported source types which need to be passed on to getPicture call.
CameraService
These are the supported camera's that need to be passed on to getPicture call.
CameraService
The direction of the arrow for the popover when a gallery or camera roll is selected on ipad.
CameraService

Methods

Method Defined By
DEPRECATED: This API will enable the publisher to determine the permissions of the photo gallery for the current application.
CameraService
getPicture(successCallback:Function, errorCallback:Function, options:object)
This API will enable to select a picture from the gallery or take a new picture from the camera.
CameraService
Inherited from adobeDPS-Class
Gets the string representation of this instance.
Class Detail
adobeDPS-CameraService()
[inner] Create an instance of the CameraService.
- This is an internal constructor and shouldn't be called by regular users.
Static Field Details
adobeDPS-CameraService.instance
The singleton of the CameraService.
Platforms:
iOS
Field Details
PictureSourceType
These are the supported source types which need to be passed on to getPicture call. The Supported Values are PHOTOLIBRARY, CAMERA & SAVEDPHOTOALBUM

ValueDescription
PHOTOLIBRARYSelect Photo Library as source type
CAMERASelect Camera as the source type
SAVEDPHOTOALBUMSelect Camera Roll as the source type


Platforms:
iOS
CameraDirection
These are the supported camera's that need to be passed on to getPicture call. The supported values are BACK and FRONT

ValueDescription
BACKSelects Back camera
FRONTSelects Front Camera


Platforms:
iOS
PopoverArrowDirection
The direction of the arrow for the popover when a gallery or camera roll is selected on ipad. The Supported values are ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_ANY

ValueDescription
ARROW_UPIndicates the arrow should point up. So the gallery is displayed down
ARROW_DOWNIndicates the arrow should point down. So the gallery is displayed above
ARROW_LEFTIndicates the arrow should point on to the left. So the gallery is displayed on to the right
ARROW_RIGHTIndicates the arrow should point on to the right. So the gallery is displayed on the left
ARROW_ANYIndicates the arrow can be in any direction


Platforms:
iOS
Method Details
initializePermissions()
DEPRECATED: This API will enable the publisher to determine the permissions of the photo gallery for the current application. This Function has to be called during AdobeDPS.initializationComplete if there is an intention of using the camera
Platforms:
iOS
getPicture(successCallback:Function, errorCallback:Function, options:object)
This API will enable to select a picture from the gallery or take a new picture from the camera.
The API can be used as follows
// To open a camera

adobeDPS.cameraService.getPicture(cameraImageHandler, cameraErrorHandler, {
                                     pictureSourceType:adobeDPS.cameraService.PictureSourceType.CAMERA,
                                     cameraDirection:cameraService.CameraDirection.FRONT,
                                     portraitOverlayImage:"480_320_v.png", 
                                     landscapeOverlayImage:"480_320_h.png",
                                     saveToPhotoAlbum:true
                                 });
//to open a Photo library
adobeDPS.cameraService.getPicture(cameraImageHandler, cameraErrorHandler, {
                                             portraitOverlayImage:"480_320_v.png",
                                             landscapeOverlayImage:"480_320_h.png",
                                             pictureSourceType:adobeDPS.cameraService.PictureSourceType.PHOTOLIBRARY,
                                             popOverOptions:{
                                             x:btn.position().left,
                                             y:btn.position().top, 
                                             width:btn.width(), 
                                             height:btn.height(), 
                                             popOverArrowDirection:adobeDPS.cameraService.PopoverArrowDirection.ARROW_ANY
                                           }
                                 });
Parameters
successCallback Function The callback function that handles the location data when operation succeeds.
Callback Signature: successHandler(imagePath)
errorCallback Function The callback function that handles the error when operation fails.
Callback Signature: errorHandler(errorCode, errorMessage)
options object The currently supported options are

1. pictureSourceType: Whether to select a picture from galley or camera roll or launch camera to take a new picture. If No value is provided, A user alert to choose between camera or photo library is popped up.

2. cameraDirection: Used only when camera is selected as pictureSource Type. Enable the user to select the front or back camera. Default value is BACK

3. saveToPhotoAlbum: if true, the selected picture is also saved to the photo library Default Value is true

4. portraitOverlayImage: The overlay image to be used for the camera or selected picture from the album in portrait orientation. The parameter provides a path relative to the web overlay. No other paths are accepted

5. landscapeOverlayImage: The overlay Image to be used for the camera or selected picture from the album in landscape orientation. The parameter provides a path relative to the web overlay. No other paths are accepted

6.popOverOptions: These options are only required for the Photo library/camera roll case. The rectangle indicate the anchor rectangle where pop over need to be drawn. For eg, when the pop up is over a button, give the rectangle as the button's co-ordinates. The pop over is popped at the center of the button.

x: the start x-point of the anchor rectangle measured in pixels

y: the start y-point of the anchor rectangle measured in pixels

width: Width of the anchor rectangle where the pop up needs to be drawn

height: Height of the anchor rectangle where the pop up needs to be drawn

popOverArrowDirection: This indicates the arrow direction for the pop up. For eg, If the desired rectangle is below some button, the direction of the arrow needs to be up. Only used when the PictureSourceType is non-camera. The default value is ARROW_ANY

Platforms:
iOS
©2012-2013 Adobe Systems, inc
Documentation generated by JsDoc Toolkit 2.4.0 on Mon Aug 31 2015 09:23:39 GMT-0700 (PDT)