public VideoConferenceControl()
        {
            InitializeComponent();

            if (DesignModeDetector.IsDesignMode)
            {
                return;
            }


            if (_videoHelper == null)
            {
                _videoHelper = new ADLVideoHelper();
            }
            _videoHelper.ToggleCamerasButton = ToggleCameras;
            _videoHelper.LocalVideoPanel     = LocalVideoPanel;
            _videoHelper.RemoteVideoPanel    = RemoteVideoPanel;
            _videoHelper.InitVideoText       = InitVideoText;

            _configDisp = this.WhenAnyDynamic(new[] { "DataContext", "Config" }, c => (VideoChatConfiguration)c.Value)
                          .ObserveOn(RxApp.MainThreadScheduler)
                          .Subscribe(config =>
            {
                if (config == null && _config != null)
                {
                    // clean up
                    _config = null;
                    _videoHelper.CleanupVideoConf();
                    _videoHelper.ViewModel = null;
                }
                else if (config != null)
                {
                    _config = config;
                    if (_videoHelper.ViewModel == null || _config != _videoHelper.ViewModel.Config)
                    {
                        _videoHelper.ViewModel = (VideoConfViewModel)DataContext;
                        _videoHelper.PrepVideoConf();
                    }
                }
            });
        }
Esempio n. 2
0
        public async Task <VideoChatConfiguration> StartMeeting(Guid meetingId)
        {
            var meeting = MeetingInfoRepository.GetMeetingInfo(meetingId);

            if (meeting == null)
            {
                return(null);
            }
            if (meeting.HasAgent)
            {
                return(null);
            }
            if (meeting.HasMeetingStarted)
            {
                return(null);
            }


            var room = meetingId.ToString();

            Debug.WriteLine("Starting meeting {0} by agent {1}", new object[] { room, Context.ConnectionId });
            var config = new VideoChatConfiguration
            {
                AppId              = 416,
                ApiKey             = "<insert ADL key here>",
                ScopeId            = room,
                MaxWidth           = 240,
                MaxHeight          = 320,
                MaxFramesPerSecond = 15,
                MaxBitRate         = 1024,
                Expires            = VideoChatConfiguration.CurrentTimeMillis() + (5 * 60),
                MeetingId          = meetingId
            };

            config.Salt = config.ScopeId;

            meeting.ConnectAgent(Context.ConnectionId);
            meeting.StartMeeting(config);

            // add caller to meeting room
            await GroupManager.AddToGroup(Groups, room, Context.ConnectionId);

            if (meeting.HasClient)
            {
                // fire off the joined message to the agent as the client is already waiting in the room
                try
                {
                    Debug.WriteLine("Meeting {0} has client, sending client joined to agent", new object[] { room });

                    Clients.Caller.clientJoined();
                }
                catch (Exception)
                {
                    Debug.WriteLine("Error calling clientJoined");
                }
                // Tell the client to start with the following config
                try
                {
                    Debug.WriteLine("Meeting {0} has client, sending start meeting to client {1}", new object[] { room, meeting.ClientConnectionId });
                    Clients.Group(room, Context.ConnectionId).startMeeting(config);
                }
                catch (Exception)
                {
                    Debug.WriteLine("Error calling startMeeting");
                }
            }

            UpdateMeetingStatusToClients(this);
            return(config);
        }
 public void StartMeeting(VideoChatConfiguration chatConfiguration)
 {
     ChatConfig = chatConfiguration;
 }