コード例 #1
0
        private void CallAdapter_OnVideoCallClick(object sender, AddNewCallAdapterClickEventArgs adapterClickEvents)
        {
            try
            {
                string timeNow       = DateTime.Now.ToString("hh:mm");
                var    unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                string time          = Convert.ToString(unixTimestamp);

                var position = adapterClickEvents.Position;
                if (position >= 0)
                {
                    var item = MAdapter.GetItem(position);
                    if (item != null)
                    {
                        Intent intentVideoCall = new Intent(this, typeof(TwilioVideoCallActivity));
                        switch (AppSettings.UseLibrary)
                        {
                        case SystemCall.Agora:
                            intentVideoCall = new Intent(this, typeof(AgoraVideoCallActivity));
                            intentVideoCall.PutExtra("type", "Agora_video_calling_start");
                            break;

                        case SystemCall.Twilio:
                            intentVideoCall = new Intent(this, typeof(TwilioVideoCallActivity));
                            intentVideoCall.PutExtra("type", "Twilio_video_calling_start");
                            break;
                        }

                        intentVideoCall.PutExtra("UserID", item.UserId);
                        intentVideoCall.PutExtra("avatar", item.Avatar);
                        intentVideoCall.PutExtra("name", item.Name);
                        intentVideoCall.PutExtra("time", timeNow);
                        intentVideoCall.PutExtra("CallID", time);
                        intentVideoCall.PutExtra("access_token", "YOUR_TOKEN");
                        intentVideoCall.PutExtra("access_token_2", "YOUR_TOKEN");
                        intentVideoCall.PutExtra("from_id", "0");
                        intentVideoCall.PutExtra("active", "0");
                        intentVideoCall.PutExtra("status", "0");
                        intentVideoCall.PutExtra("room_name", "TestRoom");

                        StartActivity(intentVideoCall);
                    }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
コード例 #2
0
        private void CallAdapter_OnAudioCallClick(object sender, AddNewCallAdapterClickEventArgs adapterClickEvents)
        {
            try
            {
                string timeNow       = DateTime.Now.ToString("hh:mm");
                var    unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                string time          = Convert.ToString(unixTimestamp);

                var position = adapterClickEvents.Position;
                if (position >= 0)
                {
                    var item = MAdapter.GetItem(position);
                    if (item != null)
                    {
                        Intent intentVideoCall = new Intent(this, typeof(TwilioVideoCallActivity));
                        if (AppSettings.UseAgoraLibrary && AppSettings.UseTwilioLibrary == false)
                        {
                            intentVideoCall = new Intent(this, typeof(AgoraAudioCallActivity));
                            intentVideoCall.PutExtra("type", "Agora_audio_calling_start");
                        }
                        else if (AppSettings.UseAgoraLibrary == false && AppSettings.UseTwilioLibrary)
                        {
                            intentVideoCall = new Intent(this, typeof(TwilioAudioCallActivity));
                            intentVideoCall.PutExtra("type", "Twilio_audio_calling_start");
                        }
                        intentVideoCall.PutExtra("UserID", item.UserId);
                        intentVideoCall.PutExtra("avatar", item.Avatar);
                        intentVideoCall.PutExtra("name", item.Name);
                        intentVideoCall.PutExtra("time", timeNow);
                        intentVideoCall.PutExtra("CallID", time);
                        intentVideoCall.PutExtra("access_token", "YOUR_TOKEN");
                        intentVideoCall.PutExtra("access_token_2", "YOUR_TOKEN");
                        intentVideoCall.PutExtra("from_id", "0");
                        intentVideoCall.PutExtra("active", "0");
                        intentVideoCall.PutExtra("status", "0");
                        intentVideoCall.PutExtra("room_name", "TestRoom");
                        StartActivity(intentVideoCall);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }