Example #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_video);

            primaryVideoView    = (VideoView)FindViewById(Resource.Id.primary_video_view);
            thumbnailVideoView  = (VideoView)FindViewById(Resource.Id.thumbnail_video_view);
            videoStatusTextView = (TextView)FindViewById(Resource.Id.video_status_textview);

            connectActionFab      = (FloatingActionButton)FindViewById(Resource.Id.connect_action_fab);
            switchCameraActionFab = (FloatingActionButton)FindViewById(Resource.Id.switch_camera_action_fab);
            localVideoActionFab   = (FloatingActionButton)FindViewById(Resource.Id.local_video_action_fab);
            muteActionFab         = (FloatingActionButton)FindViewById(Resource.Id.mute_action_fab);

            /*
             * Enable changing the volume using the up/down keys during a conversation
             */

            VolumeControlStream = Stream.VoiceCall;

            /*
             * Needed for setting/abandoning audio focus during call
             */
            audioManager = (AudioManager)GetSystemService(Context.AudioService);

            /*
             * Check camera and microphone permissions. Needed in Android M.
             */
            if (!CheckPermissionForCameraAndMicrophone())
            {
                RequestPermissionForCameraAndMicrophone();
            }
            else
            {
                CreateAudioAndVideoTracks();
                SetAccessToken();
            }

            /*
             * Set the initial state of the UI
             */
            IntializeUi();
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Console.WriteLine("OnCreate");
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            this.primaryVideoView = FindViewById <Com.Twilio.Video.VideoView>(Resource.Id.primary_video_view);
            var editTextRoomName = FindViewById <EditText>(Resource.Id.editText1);
            var buttonGetToken   = FindViewById <Button>(Resource.Id.button2);

            buttonGetToken.Click += async(s, e) => {
                var json = await GetToken("https://sosmarco.astutesolutions.org/Token");

                Console.WriteLine("Token " + json["token"]);
                this.ConnectToRoom(editTextRoomName.Text.Trim(), json["token"]);
            };
        }