Livehiddencamera - Library Which Tape Alive Video Too Well From Android Device Without Displaying A Preview
Live Hidden Camera (LHC) is a library which tape alive video together with audio from Android device without displaying a preview.
How to use
I've created a library to become far to a greater extent than usable. The exclusively requirement is to add together the library to your projection together with perish the Rtmp URL to it.
Additionally you lot should assist about:
- Your application should convey the next permissions inward
Manifest.xml
:
- You should grip that the declared permissions are granted to your application
Adding library
The usage of the library is straight. Just add together the next library to the
gradle.build
file of your project.compile 'ir.mstajbakhsh.android:LiveHiddenCamera:0.1.0'
Creating RTMP server
Before using the library, you lot should convey deployed an Rtmp server. I've ued Ant Media Server. There is a prissy lead on Ant Media Server installation inward THIS LINK.
After starting the Ant Media RTMP server, you lot should come across something similar this:
Sample Code
After adding the library to your project, produce the next steps:
- Create a shape which implements:
RtmpHandler.RtmpListener, SrsRecordHandler.SrsRecordListener, SrsEncodeHandler.SrsEncodeListener
- Create 2 fields (one for set out together with ane for preview):
somebody SrsPublisher mPublisher;
somebody SrsCameraView mCameraView;
- Implement a part for starting the Live Hidden Camera:
somebody void initHiddenCam(String rtmpURL) { HiddenCameraLayout 50 = novel HiddenCameraLayout(getApplicationContext(), novel HiddenCameraLayout.PermissionHandler() { @Override world void onPermissionNotGrantedException(Exception ex) { Log.d("HCL", "Ask user to grant permission."); Log.e("HCL", ex.getMessage()); } }); //start config CameraConfig cameraConfig = novel CameraConfig() .getBuilder(MainActivity.this.getApplicationContext()) .setCameraFacing(CameraFacing.REAR_FACING_CAMERA) .build(); mCameraView = l.initHiddenLayout(cameraConfig); mPublisher = novel SrsPublisher(mCameraView); mPublisher.setEncodeHandler(new SrsEncodeHandler(this)); mPublisher.setRtmpHandler(new RtmpHandler(this)); mPublisher.setRecordHandler(new SrsRecordHand ler(this)); mPublisher.setPreviewResolution(640, 360); mPublisher.setOutputResolution(640, 360); mPublisher.setVideoHDMode(); mPublisher.startPublish(rtmpURL); mPublisher.startCamera(); }
Contact
You tin post away make me from my website: https://mstajbakhsh.ir/