Click here to Skip to main content
15,850,750 members
Articles / Web Development / HTML5

Use Android Phone as Webcam and Surveillance Camera

Rate me:
Please Sign up or sign in to vote.
4.70/5 (25 votes)
4 Jul 2014CPOL2 min read 82.6K   49   11
Android phone as webcam or remote surveillance camera through Skype


The article describes how you can use your Android phone as webcam or remote  surveillance camera through Skype or VLC Media Player or any other applications that uses DirectShow API. The Android app used here can be found here and the source code is available here.


If you happen to have more than 1 Android phone and you are thinking of how you can make use of the old Android phone besides selling it, then this article is for you.

Using the App and the Source Code

The Android app that I developed is capable of streaming MJPEG. It uses NanoHttpd and extends it to support motion JPEG.

Whenever a video frame is captured, it is streamed as a series of JPEG images as shown below.

private class VideoStreamingTask extends AsyncTask<datastream, void=""> {
	protected Void doInBackground(DataStream... videoStreams) {
		isStreamingVideo = true;
		byte[] data = null;
		while (true) {
			if (!isStreamingVideo)

			DataStream videoStream = videoStreams[0];
			try {
				OutputStream os = videoStream.getOutputStream();
				if (os != null) {
					data = getSnapshot();
					if (data == null)
					os.write(("Content-type: image/jpeg\r\n" +
							"Content-Length: " + data.length +
					os.write(("\r\n--" + NanoHttpd.MULTIPART_BOUNDARY + "\r\n").getBytes());
			} catch (IOException e) {
				Log.e(TAG, "[doInBackground] Error writing stream", e);
			} catch (Exception e) {
				Log.e(TAG, "[doInBackground] General exception", e);
		return null;

	protected void onPostExecute(Void result) {


Look into the Java classes under package you can find the various Java classes that use NanoHttpd to host a web server inside your Android app.

By using the Android app, once you start the control panel, you should be able to access the web interface through Chrome browser. Turn on the surveillance camera and you should be able to view your camera remotely. Click on the Media Information button and you can see the URL for the MJPEG stream.

Image showing URL of web control panel

Control Panel URL


Image showing the MJPEG URL



In order for Skype to use MJPEG, download and install either IP Camera Adapter or IP Camera [JPEG/MJPEG] DirectShow Filter. Below is a screenshot of what you should see in Skype. You should see MJPEG Camera for IP Camera Adapter, or IP Camera [MJPEG/JPEG] for IP Camera [JPEG/MJPEG] DirectShow Filter.

Skype camera


Now with the MJPEG url and also make sure the camera is turned on through the web control panel, open up your Skype.

Perform the following steps 

  • click Tools > Options
  • Under Video settings, choose "MPJEG Camera" (I am using IP Camera Adapter)
  • click WebCam settings
  • Paste the MJPEG url into the Camera feed URL text box
  • click Autodetect to make sure the URL is working (make sure the camera is turned on).
  • click OK if everything is fine.


Skype webcam settings


Change the following configurations to allow Skype to answer video call automatically.

  • click Tools > Options
  • Under Calls, click Call settings
  • Click Show advanced options
  • Tick Answer incoming calls automatically.
  • Tick Start my video automatically when I am in a call


Image 5


With all the configurations in place, now is time for you to test. Create another Skype id and login using that id from another machine. In my case, I installed Skype in my tablet, and add the Skype id I used with the Android phone. 

Here is what you should see if you make a video call now.

Image 6


Using VLC Media Player

VLC Media Player also supports network streaming using MJPEG. You can open a network stream and view the video remotely.

VLC media player



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior)
Malaysia Malaysia
A programmer for a long time, and still learning everyday.

A supporter for open source solutions, and have written quite a few open source software both in .NET and Java.

Comments and Discussions

QuestionSource code link not working Pin
Kegan Tay (Ice and Water Gaming)16-Jan-23 17:36
Kegan Tay (Ice and Water Gaming)16-Jan-23 17:36 
QuestionTaking photo directly, not from video! Pin
S-Homayoon11-Feb-17 23:09
S-Homayoon11-Feb-17 23:09 
QuestionIs it the case that this APP can only operate on the same network between the phone and the computer? Pin
Member 1257898211-Jun-16 23:45
Member 1257898211-Jun-16 23:45 
QuestionConnect with 4g Pin
Member 1003483211-Aug-15 8:40
Member 1003483211-Aug-15 8:40 
AnswerRe: Connect with 4g Pin
mengwangk11-Aug-15 17:28
mengwangk11-Aug-15 17:28 
QuestionReg Issue in app Pin
Member 111342806-Oct-14 21:35
Member 111342806-Oct-14 21:35 
QuestionSource Pin
link1112-Sep-14 8:55
link1112-Sep-14 8:55 
AnswerRe: Source Pin
mengwangk3-Sep-14 0:32
mengwangk3-Sep-14 0:32 
QuestionAwesome idea and ... Pin
Afzaal Ahmad Zeeshan17-Aug-14 4:03
professionalAfzaal Ahmad Zeeshan17-Aug-14 4:03 
GeneralMy vote of 5 Pin
Ștefan-Mihai MOGA13-Aug-14 4:21
professionalȘtefan-Mihai MOGA13-Aug-14 4:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.