B4A Library A small vidéo MJPEG librarie for ip cam

Library for IP Camera MJPEG

have not found how to handle the CGI video stream with the library "camera" so I wrote my little personal library ...

MJPEG Video Streams (Network cameras streaming the video in the MJPEG format.)

LIST IP CAM: Webcam / Netcam - Security Video Camera Surveillance Software - CrazyPixels

B4X:
Sub Process_Globals
Dim timer1 As Timer
End Sub
Sub Globals
Dim mycam As Videomjpeg
Dim c  As Canvas
Dim p As Panel
Dim DestRect As Rect
End Sub

Sub Activity_Create(FirstTime As Boolean)
If FirstTime =True Then
p.Initialize("p")
p.Color=Colors.LightGray
timer1.Initialize("timer1",250)
timer1.Enabled=True
End If

End Sub
Sub maj_cam
mycam.cam("192.168.2.11",8080,"/videostream.cgi?user=admin&pwd=admin")
p.RemoveView
p.Initialize("p")
p.Color=Colors.LightGray
Activity.AddView(p,50,50,320,240)
c.Initialize(p)
DestRect.Initialize(0,0,p.Width,p.Height)
c.DrawDrawable(mycam.Image,DestRect)
mycam.unbindDrawables(p)
Activity.Invalidate
End Sub

Sub Activity_Resume
p.Initialize("p")
timer1.Enabled=True
End Sub

Sub Activity_Pause (UserClosed As Boolean)
timer1.Enabled=False
End Sub

Sub timer1_tick
maj_cam
End Sub
 

Attachments

  • ipcam.zip
    22.8 KB · Views: 1,120
Last edited:

GKCS

Member
Licensed User
Longtime User
so, obviousely, you are using either

- the wrong Password variable (pwd, psw, ....)
or

- the wrong password ....

For both, you must check your cam-settings ...
 

ciprian

Active Member
Licensed User
Longtime User
Hi there. I'm using the same library and i'm getting only one image per second.
I think Erel said that maybe he will create a new library for that in the future...but not sure.
Perhaps this new library will help us all with theese ip cameras.
 

GKCS

Member
Licensed User
Longtime User
at your link, you can find MANY different models, BUT NO SC-3115w ...
Anyway, if you don't use/have the correct username/password, the best
reference wont help ...
Connect with a normal webbrowser to this cam, try to view a snapshot.
If this works inside the normal webbrowser, have a look to the 'source' and
try to strip out the correct URL with the correct parameters.
 

agacsadi

New Member
Licensed User
Longtime User
If I USE THIS IP_CAM BUT IN THE MAIN I RECEIVE AN ERROR datasend_maj_cam(java line :514)android.os.NetworkOnMainThreadException
 

agacsadi

New Member
Licensed User
Longtime User
end how i do that? i have a main and a data send module. in which module do i have to set targetSdKVersion = "4" ?
and in which sub?
thanks
 

DonManfred

Expert
Licensed User
Longtime User

G-ShadoW

Active Member
Licensed User
Longtime User
How to send PTZ commands?
I have add this but nothing happen.

B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.AddMenuItem("PTZ4", "MenuItem")
...
...
End Sub

Sub MenuItem_Click
WebView1.loadUrl("http://my_ip_cam.dyndns.org:20022/decoder_control.cgi?command=37")
End Sub
 

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I am using the ipcam library to interface to an IP camera. It works great, thanks.

I would like to add the ability to Record - that is save the sequence of images to a file in some movie format, AVI, MPEG or …

The timer gives me a sequence of bitmaps, one every 250 ms. How could I turn this sequence of bitmaps into a movie format file?

Thanks,
Barry.
 
Top