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
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
|
|
toString()
Gets the string representation of this instance.
|
- This is an internal constructor and shouldn't be called by regular users.
- Platforms:
- iOS
Value | Description |
---|---|
PHOTOLIBRARY | Select Photo Library as source type |
CAMERA | Select Camera as the source type |
SAVEDPHOTOALBUM | Select Camera Roll as the source type |
- Platforms:
- iOS
Value | Description |
---|---|
BACK | Selects Back camera |
FRONT | Selects Front Camera |
- Platforms:
- iOS
Value | Description |
---|---|
ARROW_UP | Indicates the arrow should point up. So the gallery is displayed down |
ARROW_DOWN | Indicates the arrow should point down. So the gallery is displayed above |
ARROW_LEFT | Indicates the arrow should point on to the left. So the gallery is displayed on to the right |
ARROW_RIGHT | Indicates the arrow should point on to the right. So the gallery is displayed on the left |
ARROW_ANY | Indicates the arrow can be in any direction |
- Platforms:
- iOS
- Platforms:
- iOS
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
Documentation generated by JsDoc Toolkit 2.4.0 on Mon Aug 31 2015 09:23:39 GMT-0700 (PDT)