Page 1 of 1

Video Source Not Specified

PostPosted: Thu Jun 20, 2019 8:29 pm
by JoeNeed88
So I am testing out AForge for accessing some IP cameras on the network here and have run into a snag. I am using the Sample Source Code from the Framework 2.5.5 zip I found on Google Code.(https://code.google.com/archive/p/aforge/downloads) Everything was converted over to VB from C# and runs fine to a point. I can select the local camera option and what not with images loading fine. However, when I select the JPEG or MJPEG options it errors at the videoSourcePlayer.Start() line shown below:

Private Sub OpenVideoSource(ByVal source As IVideoSource)
Me.Cursor = Cursors.WaitCursor
CloseCurrentVideoSource()
videoSourcePlayer.VideoSource = source
videoSourcePlayer.Start() <------------------ ERROR SHOWS HERE -----------------> System.ArgumentException: 'Video source is not specified.'
stopWatch = Nothing
timer.Start()
Me.Cursor = Cursors.[Default]
End Sub

Now this is most likely an error on my part as I'm not a very strong programmer. I am at a loss as to what step to take next though.. If anyone could assist it would be greatly appreciated.

Re: Video Source Not Specified

PostPosted: Fri Jun 21, 2019 7:56 am
by andrew.kirillov
This exception is thrown by JPEGStream or MJPEGStream if you did not specify URL for the JPEG/MJPEG stream.

Re: Video Source Not Specified

PostPosted: Fri Jun 21, 2019 12:54 pm
by JoeNeed88
I have a URL I'm trying to use. I realized the url doesn't have jpeg or mjpeg in it but I still get the same error when I try to use the sample URL provided in the source code.

Re: Video Source Not Specified

PostPosted: Fri Jun 21, 2019 6:51 pm
by JoeNeed88
So, I'm past the URL issue but was wondering if there is a method with AForge to automatically set the Username and Password for login on the website when I select the camera.

Re: Video Source Not Specified

PostPosted: Fri Jun 21, 2019 7:55 pm
by andrew.kirillov
Sorry, did not get what you are trying to do.

What do you mean by setting user login and password automatically? How AForge.NET Framework is supposed to know which one to set?

Re: Video Source Not Specified

PostPosted: Mon Jun 24, 2019 4:07 pm
by JoeNeed88
I figured it out, just didn't notice the .Login and .Password options at first. I'll post the little snippet below for anyone else looking for this using VB.net.

Dim mjpegSource As MJPEGStream = New MJPEGStream("IP URL HERE")
mjpegSource.Login = "your username here"
mjpegSource.Password = "your password here"
videoSourcePlayer.VideoSource = mjpegSource
videoSourcePlayer.Start()
OpenVideoSource(mjpegSource)

Also, if your camera is on a web page that has other items on screen but you only want the feed of the camera. You can do this by right clicking the feed, click "Inspect", grab that url next to "src=" and use that for the NewMJPEGStream URL