public class SimpleCameraHost extends java.lang.Object implements CameraHost
CameraHost.FailureReason, CameraHost.RecordingHint
Constructor and Description |
---|
SimpleCameraHost(Context _ctxt) |
Modifier and Type | Method and Description |
---|---|
Camera.Parameters |
adjustPictureParameters(Camera.Parameters parameters)
Implement this to configure the Camera.Parameters just
prior to taking a photo.
|
Camera.Parameters |
adjustPreviewParameters(Camera.Parameters parameters)
Implement this to configure the Camera.Parameters for
the purposes of the preview.
|
void |
autoFocusAvailable()
This will be called by the library to let you know that
auto-focus is available for your use, so you can update
your UI accordingly.
|
void |
autoFocusUnavailable()
This will be called by the library to let you know that
auto-focus is not available for your use, so you can
update your UI accordingly.
|
void |
configureRecorderAudio(int cameraId,
MediaRecorder recorder)
This will be called by the library to give you a chance
to configure the audio of the MediaRecorder, just prior
to beginning to record a video.
|
void |
configureRecorderOutput(int cameraId,
MediaRecorder recorder)
This will be called by the library to give you a chance
to configure the output of the MediaRecorder, just
prior to beginning to record a video.
|
void |
configureRecorderProfile(int cameraId,
MediaRecorder recorder)
This will be called by the library to give you a chance
to configure the profile of the MediaRecorder, just
prior to beginning to record a video.
|
int |
getCameraId() |
DeviceProfile |
getDeviceProfile() |
protected java.io.File |
getPhotoDirectory() |
protected java.lang.String |
getPhotoFilename() |
protected java.io.File |
getPhotoPath() |
Camera.Size |
getPictureSize(Camera.Parameters parameters)
Called to allow you to be able to indicate what size
photo should be taken.
|
Camera.Size |
getPreferredPreviewSizeForVideo(int displayOrientation,
int width,
int height,
Camera.Parameters parameters,
Camera.Size deviceHint)
Same as getPreviewSize(), but called when we anticipate
taking videos, as some devices may work better with
lower-resolution previews, to reduce CPU load
|
Camera.Size |
getPreviewSize(int displayOrientation,
int width,
int height,
Camera.Parameters parameters)
Called to allow you to indicate what size preview
should be used
|
CameraHost.RecordingHint |
getRecordingHint() |
Camera.ShutterCallback |
getShutterCallback() |
protected java.io.File |
getVideoDirectory() |
protected java.lang.String |
getVideoFilename() |
protected java.io.File |
getVideoPath() |
void |
handleException(java.lang.Exception e)
Called when something blows up in CameraView, to allow
you to alert the user as you see fit
|
boolean |
mirrorFFC() |
void |
onAutoFocus(boolean success,
Camera camera) |
void |
onCameraFail(CameraHost.FailureReason reason)
Called when we failed to open the camera for one reason
or another, so you can let the user know
|
boolean |
rotateBasedOnExif() |
void |
saveImage(Bitmap bitmap)
Called when a picture has been taken.
|
protected boolean |
scanSavedImage() |
protected boolean |
useFrontFacingCamera() |
boolean |
useSingleShotMode() |
public Camera.Parameters adjustPictureParameters(Camera.Parameters parameters)
CameraHost
adjustPictureParameters
in interface CameraHost
parameters
- the Camera.Parameters to be modifiedpublic Camera.Parameters adjustPreviewParameters(Camera.Parameters parameters)
CameraHost
adjustPreviewParameters
in interface CameraHost
parameters
- the Camera.Parameters to be modifiedpublic void configureRecorderAudio(int cameraId, MediaRecorder recorder)
CameraHost
configureRecorderAudio
in interface CameraHost
cameraId
- the camera that will be used for recordingrecorder
- the MediaRecorder to be configuredpublic void configureRecorderOutput(int cameraId, MediaRecorder recorder)
CameraHost
configureRecorderOutput
in interface CameraHost
cameraId
- the camera that will be used for recordingrecorder
- the MediaRecorder to be configuredpublic void configureRecorderProfile(int cameraId, MediaRecorder recorder)
CameraHost
configureRecorderProfile
in interface CameraHost
cameraId
- the camera that will be used for recordingrecorder
- the MediaRecorder to be configuredpublic int getCameraId()
getCameraId
in interface CameraHost
public DeviceProfile getDeviceProfile()
getDeviceProfile
in interface CameraHost
public Camera.Size getPictureSize(Camera.Parameters parameters)
CameraHost
getPictureSize
in interface CameraHost
parameters
- the current camera parameterspublic Camera.Size getPreviewSize(int displayOrientation, int width, int height, Camera.Parameters parameters)
CameraHost
getPreviewSize
in interface CameraHost
displayOrientation
- orientation of the display in degreeswidth
- width of the available preview spaceheight
- height of the available preview spaceparameters
- the current camera parameterspublic Camera.Size getPreferredPreviewSizeForVideo(int displayOrientation, int width, int height, Camera.Parameters parameters, Camera.Size deviceHint)
CameraHost
getPreferredPreviewSizeForVideo
in interface CameraHost
displayOrientation
- orientation of the display in degreeswidth
- width of the available preview spaceheight
- height of the available preview spaceparameters
- the current camera parametersdeviceHint
- the size that the device itself thinks should
be used for video, which sometimes is
ridiculously lowpublic Camera.ShutterCallback getShutterCallback()
getShutterCallback
in interface CameraHost
public void handleException(java.lang.Exception e)
CameraHost
handleException
in interface CameraHost
e
- an Exception indicating what went wrongpublic boolean mirrorFFC()
mirrorFFC
in interface CameraHost
public void saveImage(Bitmap bitmap)
CameraHost
saveImage
in interface CameraHost
bitmap
- Bitmap of the picturepublic void onAutoFocus(boolean success, Camera camera)
public boolean useSingleShotMode()
useSingleShotMode
in interface CameraHost
public void autoFocusAvailable()
CameraHost
autoFocusAvailable
in interface CameraHost
public void autoFocusUnavailable()
CameraHost
autoFocusUnavailable
in interface CameraHost
public boolean rotateBasedOnExif()
rotateBasedOnExif
in interface CameraHost
public CameraHost.RecordingHint getRecordingHint()
getRecordingHint
in interface CameraHost
public void onCameraFail(CameraHost.FailureReason reason)
CameraHost
onCameraFail
in interface CameraHost
reason
- a FailureReason indicating what went wrongprotected java.io.File getPhotoPath()
protected java.io.File getPhotoDirectory()
protected java.lang.String getPhotoFilename()
protected java.io.File getVideoPath()
protected java.io.File getVideoDirectory()
protected java.lang.String getVideoFilename()
protected boolean useFrontFacingCamera()
protected boolean scanSavedImage()