This project has moved and is read-only. For the latest updates, please go here.

Help for a beginner

Nov 17, 2013 at 10:05 AM
Edited Nov 17, 2013 at 10:53 AM
Hi,

Thank you for the library.
I am almost an absolute beginner with c# and I would like to build a simple app that displays an MJPEG stream from my Android phone (using IP Webcam app) and to be able to set the source of the stream via a Textbox on the computer.

I would like to ask for a walk through on the exact steps that need to be taken.

I managed set MjpegProcessor.dll as reference to my app and I am stuck at this point.
I suppose I need to create a bitmap object on the Form and connect the stream to is somehow but I have no idea how I could achieve that.

By the way, int the article at Channel 9 it is mentioned that samples are included in the binaries but I don!t know where to find them.

I hope it is not a big problem to help a beginner like myself. :)
Nov 17, 2013 at 10:04 PM
I'm assuming you're running the Xamarin stuff if you're doing .NET on Android. Unfortunately I'm not sure how you'd use this library with that kind of setup to display the incoming frames. Hopefully someone else that might see this can...

Samples are in the source code. Click the Source Code above and then click the Download link in the upper right.
Nov 18, 2013 at 5:10 AM
I think you misunderstood me. I use my phone as an ip camera and I would like to create an application in Visual studio express so that the video steam from the phone can be watched on the computer.

Nov 18, 2013 at 5:12 AM
Gotcha. Either way, grab the samples from the Source Code tab above. There is a tester app which shows exactly how to use the library to connect to an IP camera and display the images in a variety of ways, including Windows Forms.
Dec 16, 2013 at 4:30 PM
Okay. The application runs fine now. Thank you. I have been wondering if there is a method to "stop listening to the stream". I know it's something very easy, but could you please tell me how can I stop the stream with a button?
Dec 16, 2013 at 4:43 PM
Call the StopStream method.
Dec 16, 2013 at 5:41 PM
Edited Dec 16, 2013 at 5:47 PM
I am really grateful for your patience.
I created two buttons (stop, start)

So I needed to set my MjpegDecoder object as a "global variable". And now the stream does not work I don!t understand why.

This version works, but I cannot stop it with the other button,, since it does not know what mjpeg is:

private void MJPEGstartButton_Click(object sender, EventArgs e)
    {
        MjpegDecoder mjpeg = new MjpegDecoder();
        mjpeg.FrameReady += mjpeg_FrameReady;
        mjpeg.Error += mjpeg_Error;
        mjpeg.ParseStream(new Uri((string)addressBox.Text));
    }
This version does not work, there are simply no incoming images:


MjpegDecoder mjpeg = new MjpegDecoder();

private void MJPEGstartButton_Click(object sender, EventArgs e)
    {

        mjpeg.FrameReady += mjpeg_FrameReady;
        mjpeg.Error += mjpeg_Error;
        mjpeg.ParseStream(new Uri((string)addressBox.Text));
    }
private void MJPEGstopButton_Click(object sender, EventArgs e)
    {
        mjpeg.StopStream();
        videoBox.Image = Properties.Resources.no_video;
    }
I also tried to create the object like this:

public MjpegDecoder mjpeg = new MjpegDecoder();

or

public static MjpegDecoder mjpeg = new MjpegDecoder();
Dec 16, 2013 at 6:08 PM
Edited Dec 16, 2013 at 6:09 PM
Yes, you need a member variable as you have, but instantiate it inside the constructor for the Form, not inline with the declaration:
MjpegDecoder mjpeg;

public Form1()
{
    InitializeComponent();
    mjpeg = new MjpegDecoder();
}
Dec 16, 2013 at 6:47 PM
Ok. Thank you.

I have one last question then I'll remain silent I promise. :)

Is there a way to check if the stream is active or stopped?
Dec 16, 2013 at 6:48 PM
There is not...