Example #1
0
 private void OnSignalBarsUpdated(VoipManager sender, int newCount)
 {
     this.BeginOnUIThread(() =>
     {
         SetSignalBars(newCount);
     });
 }
Example #2
0
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;
            _debugTimer.Stop();
            _durationTimer.Stop();

            if (_manager != null)
            {
                _manager.StateUpdated            -= OnStateUpdated;
                _manager.SignalBarsUpdated       -= OnSignalBarsUpdated;
                _manager.RemoteMediaStateUpdated -= OnRemoteMediaStateUpdated;

                _manager.SetIncomingVideoOutput(null);
                _manager = null;
            }

            var capturer = _service.Capturer;

            if (capturer != null)
            {
                capturer.SetOutput(null);
            }
        }
Example #3
0
    public virtual void Awake()
    {
        LogOutputLine("Start Log.");

        // Grab the MeshRenderers. We'll be using the material colour to visually show status
        helpMesh   = helpPanel.GetComponent <MeshRenderer>();
        sphereMesh = roomSphere.GetComponent <MeshRenderer>();
        floorMesh  = roomFloor.GetComponent <MeshRenderer>();

        // Set up the local player
        localTrackingSpace = this.transform.Find("OVRCameraRig/TrackingSpace").gameObject;
        localPlayerHead    = this.transform.Find("OVRCameraRig/TrackingSpace/CenterEyeAnchor").gameObject;

        // make sure only one instance of this manager ever exists
        if (s_instance != null)
        {
            Destroy(gameObject);
            return;
        }

        s_instance = this;
        DontDestroyOnLoad(gameObject);

        TransitionToState(State.INITIALIZING);

        Core.Initialize();

        roomManager = new RoomManager();
        p2pManager  = new P2PManager();
        voipManager = new VoipManager();
    }
Example #4
0
        private void OnRemoteMediaStateUpdated(VoipManager sender, RemoteMediaStateUpdatedEventArgs args)
        {
            this.BeginOnUIThread(() =>
            {
                AudioOff.Visibility = args.Audio == VoipAudioState.Muted
                    ? Visibility.Visible
                    : Visibility.Collapsed;

                VideoOff.Visibility = args.Video == VoipVideoState.Inactive && _service.Capturer != null
                    ? Visibility.Visible
                    : Visibility.Collapsed;

                BackgroundPanel.Visibility = args.Video == VoipVideoState.Inactive
                    ? Visibility.Collapsed
                    : Visibility.Visible;
            });
        }
Example #5
0
        public void Connect(VoipManager controller)
        {
            //_controller = controller;

            //_controller.SetIncomingVideoOutput(BackgroundPanel);

            // Let's avoid duplicated events
            controller.StateUpdated            -= OnStateUpdated;
            controller.SignalBarsUpdated       -= OnSignalBarsUpdated;
            controller.RemoteMediaStateUpdated -= OnRemoteMediaStateUpdated;

            controller.StateUpdated            += OnStateUpdated;
            controller.SignalBarsUpdated       += OnSignalBarsUpdated;
            controller.RemoteMediaStateUpdated += OnRemoteMediaStateUpdated;

            //controller.SetMuteMicrophone(_isMuted);

            //OnStateUpdated(controller, controller.GetConnectionState());
            //OnSignalBarsUpdated(controller, controller.GetSignalBarsCount());
        }
Example #6
0
    void Awake()
    {
        // make sure only one instance of this manager ever exists
        if (s_instance != null)
        {
            Destroy(gameObject);
            return;
        }

        s_instance = this;
        DontDestroyOnLoad(gameObject);

        TransitionToState(State.INITIALIZING);

        Core.Initialize();

        m_roomManager = new RoomManager();
        m_p2pManager  = new P2PManager(m_remoteHead.transform);
        m_voipManager = new VoipManager(m_remoteHead);
    }
Example #7
0
        private void OnStateUpdated(VoipManager sender, VoipState newState)
        {
            this.BeginOnUIThread(() =>
            {
                switch (newState)
                {
                case VoipState.WaitInit:
                case VoipState.WaitInitAck:
                    _state             = newState;
                    StateLabel.Content = Strings.Resources.VoipConnecting;
                    break;

                case VoipState.Established:
                    _state             = newState;
                    StateLabel.Content = "00:00";

                    SignalBarsLabel.Visibility = Visibility.Visible;
                    StartUpdatingCallDuration();

                    sender.SetIncomingVideoOutput(BackgroundPanel);
                    break;

                case VoipState.Failed:
                    //switch (sender.GetLastError())
                    //{
                    //    case libtgvoip.Error.Incompatible:
                    //    case libtgvoip.Error.Timeout:
                    //    case libtgvoip.Error.Unknown:
                    //        _state = newState;
                    //        StateLabel.Content = Strings.Resources.VoipFailed;
                    //        break;
                    //}
                    break;
                }
            });
        }
Example #8
0
        public void Connect(VoipManager controller)
        {
            if (_disposed)
            {
                return;
            }

            if (_manager != null)
            {
                // Let's avoid duplicated events
                _manager.StateUpdated            -= OnStateUpdated;
                _manager.SignalBarsUpdated       -= OnSignalBarsUpdated;
                _manager.RemoteMediaStateUpdated -= OnRemoteMediaStateUpdated;

                if (_manager != controller)
                {
                    _manager.SetIncomingVideoOutput(BackgroundPanel);
                }
            }

            if (_manager != controller)
            {
                controller.SetIncomingVideoOutput(BackgroundPanel);
            }

            controller.StateUpdated            += OnStateUpdated;
            controller.SignalBarsUpdated       += OnSignalBarsUpdated;
            controller.RemoteMediaStateUpdated += OnRemoteMediaStateUpdated;

            _manager = controller;

            //controller.SetMuteMicrophone(_isMuted);

            //OnStateUpdated(controller, controller.GetConnectionState());
            //OnSignalBarsUpdated(controller, controller.GetSignalBarsCount());
        }