コード例 #1
0
        public void StartChat(string userAlias, List <BandyerSdkForms.ChatWithCallCapability> callCapabilities, List <BandyerSdkForms.InCallCapability> inCallCapabilities, List <BandyerSdkForms.InCallOptions> inCallOptions)
        {
            CallCapabilities capabilities = new CallCapabilities();

            if (inCallCapabilities.Contains(BandyerSdkForms.InCallCapability.Whiteboard))
            {
                capabilities.WithWhiteboard();
            }
            if (inCallCapabilities.Contains(BandyerSdkForms.InCallCapability.FileSharing))
            {
                capabilities.WithFileSharing();
            }
            if (inCallCapabilities.Contains(BandyerSdkForms.InCallCapability.Chat))
            {
                capabilities.WithChat();
            }
            if (inCallCapabilities.Contains(BandyerSdkForms.InCallCapability.ScreenSharing))
            {
                capabilities.WithScreenSharing();
            }

            CallOptions options = new CallOptions();

            if (inCallOptions.Contains(BandyerSdkForms.InCallOptions.CallRecording))
            {
                options.WithRecordingEnabled(); // if the call started should be recorded
            }
            if (inCallOptions.Contains(BandyerSdkForms.InCallOptions.BackCameraAsDefault))
            {
                options.WithBackCameraAsDefault(); // if the call should start with back camera
            }
            if (inCallOptions.Contains(BandyerSdkForms.InCallOptions.DisableProximitySensor))
            {
                options.WithProximitySensorDisabled(); // if the proximity sensor should be disabled during calls
            }

            BandyerIntent.Builder builder           = new BandyerIntent.Builder();
            ChatIntentBuilder     chatIntentBuilder = builder.StartWithChat(MainActivity.Application /* context */);
            ChatIntentOptions     chatIntentOptions = chatIntentBuilder.With(userAlias);

            if (callCapabilities.Contains(BandyerSdkForms.ChatWithCallCapability.AudioOnly))
            {
                chatIntentOptions.WithAudioCallCapability(capabilities, options); // optional
            }
            if (callCapabilities.Contains(BandyerSdkForms.ChatWithCallCapability.AudioUpgradable))
            {
                chatIntentOptions.WithAudioUpgradableCallCapability(capabilities, options); // optionally upgradable to audio video call
            }
            if (callCapabilities.Contains(BandyerSdkForms.ChatWithCallCapability.AudioVideo))
            {
                chatIntentOptions.WithAudioVideoCallCapability(capabilities, options); // optional
            }
            BandyerIntent bandyerChatIntent = chatIntentOptions.Build();

            MainActivity.StartActivity(bandyerChatIntent);
        }