Click here to Skip to main content
15,921,531 members
Home / Discussions / C#
   

C#

 
AnswerRe: error:cannot access disposed object Pin
Moreno Airoldi26-Apr-09 0:40
Moreno Airoldi26-Apr-09 0:40 
QuestionInstalling Visual Studio.NET 2008......Help needed! Pin
Rajdeep.NET is BACK25-Apr-09 20:20
Rajdeep.NET is BACK25-Apr-09 20:20 
AnswerRe: Installing Visual Studio.NET 2008......Help needed! Pin
DaveyM6925-Apr-09 22:07
professionalDaveyM6925-Apr-09 22:07 
GeneralRe: Installing Visual Studio.NET 2008......Help needed! Pin
Rajdeep.NET is BACK25-Apr-09 23:26
Rajdeep.NET is BACK25-Apr-09 23:26 
GeneralRe: Installing Visual Studio.NET 2008......Help needed! Pin
harold aptroot26-Apr-09 3:05
harold aptroot26-Apr-09 3:05 
Questionuse dll in net2008 Pin
ZAHEDI_HOSSEIN25-Apr-09 19:16
ZAHEDI_HOSSEIN25-Apr-09 19:16 
AnswerRe: use dll in net2008 Pin
DaveyM6925-Apr-09 19:35
professionalDaveyM6925-Apr-09 19:35 
QuestionVideo chat... first one but does it look ok? Pin
Jacob Dixon25-Apr-09 18:25
Jacob Dixon25-Apr-09 18:25 
Well I seem to have the video chat between two people working pretty good. I am going to post the code below to see what you guys think and if you see problems. I haven't tried it remotely, but on the internal network it seems to work well.

What I would like to do it enable multiple ones. Before I ask the question I am going to post what I have below:

For this project I used the modified DirectX.Capture provided by hpAng: DirectX Video Stream and frame capture[^]


Here I am listening on port 50000. Now if I wanted to do multiple videos from different people, I could just take the data and place it in certain panels or picture boxes depending on the IP address it came from right? An idea I have but have not tried it yet. How will that affect me sending that much data on one port? I will show how I am sending below:
private void bwGetUdp_DoWork(object sender, DoWorkEventArgs e)
{
    receiveClient = new UdpClient(50000);
    receivePoint = new IPEndPoint(new IPAddress(0), 0);

    while (true)
    {
        if (bwGetUdp.CancellationPending)
        {
            receiveClient.Close();
            e.Cancel = true;
        }
        else
        {
            byte[] data = receiveClient.Receive(ref receivePoint);
            MemoryStream ms = new MemoryStream(data);

            Invoke(new SetStreamPictureDelegate(SetStreamPicture), new object[] { Image.FromStream(ms) });
            Invoke(new ChangeReceivingLabelDelegate(ChangeReceivingLabel), new object[] { receivePoint.Address + ":" + receivePoint.Port });

            ms.Flush();
            ms.Close();
        }
    }
}


Here I am showing the video in a panel (DirectX.Capture) and starting the timer to capture the picture.
I am also setting the IPEndPoint to the users IP I get from the chat window I created.
Filters filters = new Filters();

cam = new Capture(filters.VideoInputDevices[0], filters.AudioInputDevices[0]);

cam.PreviewWindow = panelMyVideo;
cam.FrameEvent2 += new Capture.HeFrame(CaptureDone);

sendClient = new UdpClient(50001);
sendPoint = new IPEndPoint(IPAddress.Parse(this.toUserIP), 50000);
timerTakePic.Enabled = true;


Here I am just using the code provided by the article and sending it to the users IP
private delegate void SetStreamPictureDelegate(Image img);
private void SetStreamPicture(Image img)
{
    pictureBoxOtherVideo.Image = img;
}

private void CaptureDone(Bitmap e)
{
    MemoryStream ms = new MemoryStream();
    e.Save(ms, ImageFormat.Jpeg);

    Invoke(new ChangeSendingLabelDelegate(ChangeSendingLabel), new object[] { sendPoint.Address + "... " + Convert.ToInt32(ms.ToArray().Length) / 1024 + "KB" });
    sendClient.Send(ms.ToArray(), Convert.ToInt32(ms.Length), sendPoint);

    ms.Flush();
    ms.Close();
}


Obviously I'm using UDP which I hear you supposed to... this is my first time really messing with UDP or TCP for that matter. The timer is ticking every 50ms.. Now my next step is voice then multiple videos.. maybe visa versa.

Is there a better way I should be doing this?
QuestionImplementing WPF in a Visual C# project........ is it possible? Pin
Rajdeep.NET is BACK25-Apr-09 16:34
Rajdeep.NET is BACK25-Apr-09 16:34 
AnswerRe: Implementing WPF in a Visual C# project........ is it possible? Pin
Sibugathulla25-Apr-09 17:10
professionalSibugathulla25-Apr-09 17:10 
GeneralRe: Implementing WPF in a Visual C# project........ is it possible? Pin
Rajdeep.NET is BACK25-Apr-09 19:58
Rajdeep.NET is BACK25-Apr-09 19:58 
QuestionError in declaring a bitmap as the .image of a picture box Pin
sebogawa25-Apr-09 15:33
sebogawa25-Apr-09 15:33 
AnswerRe: Error in declaring a bitmap as the .image of a picture box Pin
Sibugathulla25-Apr-09 17:19
professionalSibugathulla25-Apr-09 17:19 
QuestionRe: Error in declaring a bitmap as the .image of a picture box Pin
sebogawa25-Apr-09 21:00
sebogawa25-Apr-09 21:00 
AnswerRe: Error in declaring a bitmap as the .image of a picture box Pin
Christian Graus25-Apr-09 22:57
protectorChristian Graus25-Apr-09 22:57 
GeneralRe: Error in declaring a bitmap as the .image of a picture box Pin
sebogawa25-Apr-09 23:03
sebogawa25-Apr-09 23:03 
AnswerRe: Error in declaring a bitmap as the .image of a picture box Pin
Luc Pattyn26-Apr-09 0:48
sitebuilderLuc Pattyn26-Apr-09 0:48 
Question[Message Deleted] Pin
Mohamed Ibrahim Omar25-Apr-09 11:22
Mohamed Ibrahim Omar25-Apr-09 11:22 
AnswerRe: 4 bits Array Pin
Christian Graus25-Apr-09 11:26
protectorChristian Graus25-Apr-09 11:26 
GeneralRe: 4 bits Array Pin
Mohamed Ibrahim Omar25-Apr-09 12:05
Mohamed Ibrahim Omar25-Apr-09 12:05 
GeneralRe: 4 bits Array Pin
fly90425-Apr-09 12:37
fly90425-Apr-09 12:37 
GeneralRe: 4 bits Array Pin
Christian Graus25-Apr-09 13:23
protectorChristian Graus25-Apr-09 13:23 
GeneralRe: 4 bits Array [modified] Pin
Mohamed Ibrahim Omar25-Apr-09 12:10
Mohamed Ibrahim Omar25-Apr-09 12:10 
GeneralRe: 4 bits Array Pin
Christian Graus25-Apr-09 13:22
protectorChristian Graus25-Apr-09 13:22 
AnswerRe: 4 bits Array Pin
fly90425-Apr-09 12:33
fly90425-Apr-09 12:33 

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.