Ejemplo n.º 1
0
        //void h_InConference(iConfRTC.Shared.ConferenceEventArgs e)
        //{
        //    ShowMessage((e.userName == model.UserName ? "You " : e.userName) + " joined " + e.conferenceId);
        //    // MessageBox.Show("You (" + e.userName + ") have joined  conference  + e.conferenceId);
        //    h.EnableOverlay("In conference : " + e.conferenceId, "position:absolute;bottom:0px;color:#FFF;text-align:center;font-size:20px;background-color:rgba(221,221,221,0.3);width:640px;padding:10px0;z-index:2147483647;font-family: Verdana, Geneva, sans-serif;", true);
        //}

        private void ProcessParticipants(List <MeetingParticipants> participants, string sessionJoined, bool isSharing)
        {
            foreach (var participant in participants)
            {
                if (participant.Session != rtcControl.MySession) //you are already seeing yourself :)
                {
                    var sessionExists = currParticipants.Any(p => p.Session == participant.Session);

                    if (!sessionExists)
                    {
                        var viewer = new RTCControl
                        {
                            SignalingType = SignalingTypes.Socketio,
                            SignalingUrl  = model.SignalingUrl,
                            Height        = 360,
                            Width         = 480,
                            Visibility    = System.Windows.Visibility.Visible,
                            ToolTip       = participant.UserName,
                            MySession     = participant.Session
                        };

                        int elementPosition = videoList.Children.Add(viewer);
                        currParticipants.Add(new CurrentParticipants
                        {
                            Session         = participant.Session,
                            UserName        = participant.UserName,
                            ElementPosition = elementPosition,
                            Viewer          = viewer
                        });

                        MainWindow1.UpdateLayout();
                        AttachLoadingAdorner(viewer, participant.UserName);

                        //only call webrtc functions when WebRTC is ready!!
                        viewer.RTCInitialized += (((object a) =>
                        {
                            //you can add a turn server here
                            //viewer.AddIceServer(url: "numb.viagenie.ca", userName: "******", password: "******", clearFirst: false, type: "turn");
                            //viewer.AddIceServer("stun.voiparound.com");

                            //webrtc is ready, connect to signaling
                            viewer.ViewSession(participant.UserName, participant.Session);
                        }));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void ProcessParticipants(List <MeetingParticipants> participants, string sessionJoined, bool isSharing)
        {
            foreach (var participant in participants)
            {
                if (participant.Session != rtcControl.MySession) //you are already seeing yourself :)
                {
                    var sessionExists = currParticipants.Any(p => p.Session == participant.Session);

                    if (!sessionExists)
                    {
                        var viewer = new RTCControl
                        {
                            SignalingType = SignalingTypes.Socketio,
                            SignalingUrl  = model.SignalingUrl,
                            Height        = 360,
                            Width         = 480,
                            Visibility    = System.Windows.Visibility.Visible,
                            ToolTip       = participant.UserName,
                            MySession     = participant.Session
                        };

                        int elementPosition = videoList.Children.Add(viewer);
                        currParticipants.Add(new CurrentParticipants
                        {
                            Session         = participant.Session,
                            UserName        = participant.UserName,
                            ElementPosition = elementPosition,
                            Viewer          = viewer
                        });

                        MainWindow1.UpdateLayout();
                        AttachLoadingAdorner(viewer, participant.UserName);

                        //only call webrtc functions when WebRTC is ready!!
                        viewer.RTCInitialized += (((object a) =>
                        {
                            viewer.ViewSession(participant.UserName, participant.Session);
                        }));
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This is where we go through each participant and setup a viewer which is another instance of the iConfRTC control
        /// </summary>
        /// <param name="participants">the list of participants of the meeting</param>
        private void ProcessParticipants(List <MeetingParticipants> participants)
        {
            foreach (var participant in participants)
            {
                if (participant.Session != rtcControl.MySession)
                {
                    RTCControl viewer;
                    viewer = new RTCControl();
                    viewer.SignalingType = SignalingTypes.Socketio;// SignalingTypes.SignalR;// SignalingTypes.Socketio;
                    viewer.SignalingUrl  = model.SignalingUrl;
                    viewer.Height        = 360;
                    viewer.Width         = 480;


                    viewer.Visibility = System.Windows.Visibility.Visible;
                    viewer.ToolTip    = participant.UserName;
                    viewer.MySession  = participant.Session;



                    //check to see if we are already viewing the session
                    foreach (object item in videoList.Children)
                    {
                        if (item.GetType() == typeof(RTCControl))
                        {
                            var session = (item as RTCControl).MySession;
                            if (session != null)
                            {
                                if (session == participant.Session)
                                {
                                    return;
                                }
                                else
                                {
                                    continue;
                                }
                            }
                        }
                    }

                    int elementPosition = videoList.Children.Add(viewer);
                    currParticipants.Add(new CurrentParticipants {
                        Session = participant.Session, UserName = participant.UserName, ElementPosition = elementPosition, Viewer = viewer
                    });

                    MainWindow1.UpdateLayout();
                    AttachLoadingAdorner(viewer, participant.UserName, participant.Session);


                    ///only call webrtc functions when WebRTC is ready!!
                    viewer.RTCInitialized += (((object a) =>
                    {
                        //you can add a turn server here
                        //viewer.AddIceServer(url: "numb.viagenie.ca", userName: "******", password: "******", clearFirst: false, type: "turn");
                        //viewer.AddIceServer("stun.voiparound.com");

                        //webrtc is ready, connect to signaling
                        string ranUser = Helper.RandomString(8);
                        viewer.ViewSession(participant.Session);
                    }));
                }
            }
        }
Ejemplo n.º 4
0
        private void ProcessParticipants(List <MeetingParticipants> participants, string sessionJoined, bool isSharing)
        {
            //when a user joins a meeting we receive a list of meeting participants ( including yourself )
            //we go through the list , create viewers (RTCControls) for each participant and call ViewSession,
            //passing along the participant's sessionId

            foreach (var participant in participants)
            {
                if (participant.Session != iconfRTC.MySession) //you are already seeing yourself :)
                {
                    if (participant.UserName == "sharing-" + iconfRTC.MyUserName)
                    {
                        return;
                    }

                    var sessionExists = currParticipants.Any(p => p.Session == participant.Session);

                    if (!sessionExists)
                    {
                        var viewer = new RTCControl
                        {
                            SignalingType = SignalingTypes.Socketio,
                            SignalingUrl  = iconfRTC.SignalingUrl,
                            Dock          = DockStyle.Fill
                        };



                        var pnlViewerParent = new OutlookPanelEx()
                        {
                            Tag    = participant.Session,
                            Width  = 480,
                            Height = 360
                        };


                        pnlViewerParent.Controls.Add(viewer);

                        if (participant.Session == sessionJoined && isSharing)
                        {
                            //overlay sharing picturebox
                            var overlayPicture = new PictureBox
                            {
                                SizeMode = PictureBoxSizeMode.AutoSize,
                                Image    = pbSharing.Image,
                                Dock     = DockStyle.Fill,
                                Anchor   = AnchorStyles.Bottom | AnchorStyles.Right
                            };
                            overlayPicture.Show();
                            pnlViewerParent.Controls.Add(overlayPicture);
                            overlayPicture.BringToFront();
                            var workingArea = pnlViewerParent.Bounds;
                            overlayPicture.Location = new Point(workingArea.Right - Size.Width,
                                                                workingArea.Bottom - Size.Height);
                        }

                        pnlViewerParent.Visible    = true;
                        pnlViewerParent.HeaderText = participant.UserName;
                        pnlLayout.Controls.Add(pnlViewerParent);

                        currParticipants.Add(new CurrentParticipants
                        {
                            Session     = participant.Session,
                            UserName    = participant.UserName,
                            PanelLayout = pnlViewerParent,
                            RTCControl  = viewer
                        });


                        //only call webrtc functions when WebRTC is ready!!
                        viewer.RTCInitialized += a =>
                        {
                            //you can add additional ice servers if you'd like
                            //  viewer.AddIceServer(url: "numb.viagenie.ca", userName: "******", password: "******", clearFirst: false, type: "turn");
                            //viewer.AddIceServer("stun.voiparound.com");

                            //webrtc is ready, connect to signaling
                            viewer.ViewSession(participant.UserName, participant.Session);
                        };
                    }
                }
            }
        }