private void InitializeService(LanguageConfig conf)
        {
            var lang   = SupportedLanguage.FromLanguageTag(conf.LanguageCode);
            var config = new AIConfiguration(conf.AccessToken, lang);

            //TODO: Option for verbose logging. Remove this line in production.
            config.DebugLog = true;

            if (aiService != null)
            {
                aiService.Cancel();
            }

            aiService = AIService.CreateService(config);

            aiService.OnResult          += AiService_OnResult;
            aiService.OnError           += AiService_OnError;
            aiService.ListeningStarted  += AiService_ListeningStarted;
            aiService.ListeningFinished += AiService_ListeningFinished;
            aiService.AudioLevelChanged += AiService_AudioLevelChanged;
        }
        void SelectLanguageSpinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            var selectedLanguage = languages[e.Position];

            var lang   = SupportedLanguage.FromLanguageTag(selectedLanguage.LanguageCode);
            var config = new AIConfiguration("62f2522a-7404-4c28-b9ac-097ca5d8b32d",
                                             selectedLanguage.AccessToken, lang);

            if (aiService != null)
            {
                aiService.Cancel();
            }

            aiService = new SpeaktoitRecognitionService(this, config);

            aiService.OnResult          += AiService_OnResult;
            aiService.OnError           += AiService_OnError;
            aiService.ListeningStarted  += AiService_ListeningStarted;
            aiService.ListeningFinished += AiService_ListeningFinished;
            aiService.AudioLevelChanged += AiService_AudioLevelChanged;
        }
        private void InitializeService(LanguageConfig conf)
        {
            var lang   = SupportedLanguage.FromLanguageTag(conf.LanguageCode);
            var config = new AIConfiguration("62f2522a-7404-4c28-b9ac-097ca5d8b32d",
                                             conf.AccessToken, lang);

            config.JsonProcessingWithoutDynamicCode = true;
            config.DebugLog = true;

            if (aiService != null)
            {
                aiService.Cancel();
            }

            aiService = new SpeaktoitRecognitionService(config);

            aiService.OnResult          += AiService_OnResult;
            aiService.OnError           += AiService_OnError;
            aiService.ListeningStarted  += AiService_ListeningStarted;
            aiService.ListeningFinished += AiService_ListeningFinished;
            aiService.AudioLevelChanged += AiService_AudioLevelChanged;
        }
Ejemplo n.º 4
0
        void SelectLanguageSpinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            var selectedLanguage = languages[e.Position];

            var lang   = SupportedLanguage.FromLanguageTag(selectedLanguage.LanguageCode);
            var config = new AIConfiguration("62f2522a-7404-4c28-b9ac-097ca5d8b32d",
                                             selectedLanguage.AccessToken, lang);

            //TODO: Option for verbose logging. Remove this line in production.
            config.DebugLog = true;

            if (aiService != null)
            {
                aiService.Cancel();
            }

            aiService = AIService.CreateService(this, config, RecognitionEngine.ApiAi);

            aiService.OnResult          += AiService_OnResult;
            aiService.OnError           += AiService_OnError;
            aiService.ListeningStarted  += AiService_ListeningStarted;
            aiService.ListeningFinished += AiService_ListeningFinished;
            aiService.AudioLevelChanged += AiService_AudioLevelChanged;
        }