Skip to content

mistreckless/PortraitCameraSupport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

I don't support this library anymore

Portrait Camera Support Library

Simple library for fixed portrait screen orientation camera apps(like instagram) that supports camera1 and camera2 api and allows you to display preview, reselect camera type(FRONT/BACK), take and save pictures(library determines the current position of the screen and save the image in correct orientations), enable/disable flash mode

#Install Add the following code in your gradle.build file

compile 'com.github.mistreckless:portraitcamera-support:0.1.0'

#Manifest

#Usage CameraSupport cameraSupport=CameraSupportFactory.getInstance().getCameraSupport(getActivity(),autoFitTextureView); or for some devices with api>21 that doesn't supported camera2

cameraSupport = CameraSupportFactory.getInstance()
.getCameraSupport(getActivity(), autoFitTextureView, CameraSupportController.CameraApi.OLD);

##Preview @Override public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { cameraSupport.startPreview(surface, width, height,CameraSupportController.CameraType.BACK); }

##Take picture cameraSupport.takePhoto(new OnSupportCameraTakePictureListener() { @Override public void onPicture(byte[] bytes) { cameraSupport.savePicture(bytes, System.currentTimeMillis() + "TestPicture.jpg", Environment.getExternalStorageDirectory() + "/TestDir"); }

##Reselect camera type cameraSupport.changeCameraType(cameraSupport.getCurrentCameraType() == CameraSupportController.CameraType.BACK ? CameraSupportController.CameraType.FRONT : CameraSupportController.CameraType.BACK);

##Enable/Disable flash cameraSupport.setAutoFlashEnabled(true)//false

my website

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages