Beispiel #1
0
        private void CreateAudioAndVideoTracks()
        {
            // Share your microphone
            localAudioTrack = LocalAudioTrack.Create(this, true);

            // Share your camera
            cameraCapturerCompat = new CameraCapturerCompat(this, CameraCapturer.CameraSource.FrontCamera);
            localVideoTrack      = LocalVideoTrack.Create(this, true, cameraCapturerCompat.GetVideoCapturer());
            primaryVideoView.SetMirror(true);
            localVideoTrack.AddRenderer(primaryVideoView);
            localVideoView = primaryVideoView;
        }
Beispiel #2
0
        /*
         * The initial state when there is no active room.
         */
        private void IntializeUi()
        {
            connectActionFab.SetImageDrawable(ContextCompat.GetDrawable(this, Resource.Drawable.ic_call_white_24px));
            connectActionFab.Show();
            //connectActionFab.SetOnClickListener(ConnectActionClickListener());
            connectActionFab.Click += (sender, args) =>
            {
                ShowConnectDialog();
            };

            switchCameraActionFab.Show();
            //switchCameraActionFab.SetOnClickListener(SwitchCameraClickListener());
            switchCameraActionFab.Click += (sender, args) =>
            {
                if (cameraCapturerCompat != null)
                {
                    CameraCapturer.CameraSource cameraSource = cameraCapturerCompat.GetCameraSource();
                    cameraCapturerCompat.SwitchCamera();
                    if (thumbnailVideoView.Visibility == ViewStates.Visible)
                    {
                        thumbnailVideoView.SetMirror(cameraSource == CameraCapturer.CameraSource.BackCamera);
                    }
                    else
                    {
                        primaryVideoView.SetMirror(cameraSource == CameraCapturer.CameraSource.BackCamera);
                    }
                }
            };


            localVideoActionFab.Show();
            //localVideoActionFab.SetOnClickListener(LocalVideoClickListener());
            localVideoActionFab.Click += (sender, args) =>
            {
                /*
                 * Enable/disable the local video track
                 */
                if (localVideoTrack != null)
                {
                    bool enable = !localVideoTrack.IsEnabled;
                    localVideoTrack.Enable(enable);
                    int icon;
                    if (enable)
                    {
                        icon = Resource.Drawable.ic_videocam_green_24px;
                        switchCameraActionFab.Show();
                    }
                    else
                    {
                        icon = Resource.Drawable.ic_videocam_off_red_24px;
                        switchCameraActionFab.Hide();
                    }
                    localVideoActionFab.SetImageDrawable(ContextCompat.GetDrawable(this, icon));
                }
            };

            muteActionFab.Show();
            //muteActionFab.SetOnClickListener(MuteClickListener());
            muteActionFab.Click += (sender, args) =>
            {
                if (localAudioTrack != null)
                {
                    bool enable = !localAudioTrack.IsEnabled;
                    localAudioTrack.Enable(enable);
                    int icon = enable ?
                               Resource.Drawable.ic_mic_green_24px : Resource.Drawable.ic_mic_off_red_24px;
                    muteActionFab.SetImageDrawable(ContextCompat.GetDrawable(this, icon));
                }
            };
        }