Android Question Accessing Android Camera through PC Application

Jeorge Lumaban

Member
Licensed User
Hi All,
I'm new to B4A programming. I'm doing a project to access the camera for android phone using PC application
Is there a way or hint to start with this. I search some IP Cam or DroidCam from store needed to install
for the phone and a separate application. Is there a way that I can directly control the camera using only PC application via USB. Im using Aforge.net library for image processing.
If not what android library should be use for some kind of DroidCam application?

Thanks in advance.

Jeorge
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Jeorge Lumaban

Member
Licensed User
USB connection by itself is not enough. Only if USB debug mode is configured and enabled you can create a network connection over USB.


Hi Erel,

Tnx for the info. Yes I will used USB debug mode. I want to create such cctv example but via USB not wifi network.
How should I start with this? Any help. Thanks..
 
Upvote 0

Jeorge Lumaban

Member
Licensed User
Upvote 0

Jeorge Lumaban

Member
Licensed User
You can run the following command:
B4X:
adb forward tcp:5007 tcp:2222
The Android device should listen to port 2222.
The PC should connect to 127.0.0.1 port 5007.


Hi Erel,

Is the port 2222 and 5007 is a default port for USB debug mode or I can use any valid port?
Thanks..
 
Upvote 0

Jeorge Lumaban

Member
Licensed User
You can use any port numbers you like. I recommend you to implement the PC side with B4J.

Hi Erel,

Thanks..
On the adb forward command..

adb forward tcp:5007 tcp:2222
The Android device should listen to port 2222.
The PC should connect to 127.0.0.1 port 5007.

What should be the port should I change on the PC application and B4A application.
The sample below used port 17178.

https://www.b4x.com/android/forum/t...closed-circuit-tv-cctv-example.23601/#content
and here
https://www.b4x.com/android/forum/threads/server-cctv-server.37382/#content

Sample Code:

B4A

Public ServerIp As String = "10.40.53.110"
Public ServerPort As Int = 17178
Private IntervalMs As Int = 150


VB Net

PrivateSub Form1_Load(sender AsObject, e AsEventArgs) HandlesMyBase.Load
server = New CameraServer.MiniServer(17178, Me)
EndSub
 
Upvote 0
Top