Пример #1
0
 public void SetLocalVideoTrack(LocalVideoTrack videoTracklocal)
 {
     try
     {
         if (LocalvideoTrack == null)
         {
             LocalvideoTrack = videoTracklocal;
             var trackId = videoTracklocal?.TrackId;
             if (_localVideoTrackId == trackId)
             {
                 LocalvideoTrack.Enable(false);
                 return;
             }
             else
             {
                 _localVideoTrackId = trackId;
                 LocalvideoTrack.Enable(false);
             }
         }
         else
         {
             if (LocalvideoTrack.IsEnabled)
             {
                 LocalvideoTrack.Enable(false);
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
 public void SetLocalVideoTrack(LocalVideoTrack track)
 {
     try
     {
         if (LocalVideoTrack == null)
         {
             LocalVideoTrack = track;
             var trackId = track?.Name;
             if (LocalVideoTrackId == trackId)
             {
                 LocalVideoTrack.Enable(false);
             }
             else
             {
                 LocalVideoTrackId = trackId;
                 LocalVideoTrack.Enable(false);
             }
         }
         else
         {
             if (LocalVideoTrack.IsEnabled)
             {
                 LocalVideoTrack.Enable(false);
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Пример #3
0
 public void SetLocalVideoTrack(LocalVideoTrack track)
 {
     try
     {
         if (LocalVideoTrack == null)
         {
             LocalVideoTrack = track;
             var trackId = track?.Name;
             if (LocalVideoTrackId == trackId)
             {
                 LocalVideoTrack.Enable(false);
             }
             else
             {
                 LocalVideoTrackId = trackId;
                 LocalVideoTrack.Enable(false);
             }
         }
         else
         {
             if (LocalVideoTrack.IsEnabled)
             {
                 LocalVideoTrack.Enable(false);
             }
         }
     }
     catch (Exception e)
     {
         Methods.DisplayReportResultTrack(e);
     }
 }
        private void Mute_video_button_Click(object sender, EventArgs e)
        {
            try
            {
                if (MuteVideoButton.Selected)
                {
                    MuteVideoButton.SetImageResource(Resource.Drawable.ic_camera_video_mute);

                    MuteVideoButton.Selected = false;
                }
                else
                {
                    MuteVideoButton.SetImageResource(Resource.Drawable.ic_camera_video_open);
                    MuteVideoButton.Selected = true;
                }

                var isVideoEnabled = MuteVideoButton.Selected;
                FindViewById(Resource.Id.local_video_container).Visibility = isVideoEnabled ? ViewStates.Visible : ViewStates.Gone;
                LocalVideoTrack.Enable(isVideoEnabled);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Пример #5
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));
                }
            };
        }