You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the direct line with the code below. I have speech recognition working with IOs but when a response with the input hint set to expecting input comes back, speech recognition becomes unusable until I send something back. This often happens with PromptDialog.Confirm. Since IOs does not allow audio recording unless done from a direct user tap/click, I am guessing the problem is with the speech recognizer trying to start recording audio but it can't.
const user = {
id: document.getElementById("userId").value,
name: document.getElementById("userName").value
};
const bot = {
id: params['botid'] || 'botid',
name: params['botname'] || 'botname'
};
window.botchatDebug = params['debug'] && params['debug'] === 'true';
var speechOptions;
if (Modernizr.speechsynthesis) {
speechOptions = {
speechRecognizer: new CognitiveServices.SpeechRecognizer({
fetchCallback: (authFetchEventId) => getBingToken(),
fetchOnExpiryCallback: (authFetchEventId) => getBingToken()
}),
speechSynthesizer: new BotChat.Speech.BrowserSpeechSynthesizer()
};
}
else {
speechOptions = null;
}
var botConnection = new BotChat.DirectLine({
domain: params['domain'],
token: document.getElementById("directLineToken").value,
webSocket: params['webSocket'] && params['webSocket'] === 'true' // defaults to true
});
BotChat.App({
bot: bot,
locale: params['locale'],
resize: 'detect',
speechOptions: speechOptions,
user: user,
botConnection: botConnection
}, document.getElementById('BotChatGoesHere'));
var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
function SpeakText() {
var msg = new SpeechSynthesisUtterance();
window.speechSynthesis.speak(msg);
document.getElementsByClassName("wc-mic")[0].removeEventListener("click", SpeakText);
}
if (isSafari) {
window.addEventListener("load", function () {
document.getElementsByClassName("wc-mic")[0].addEventListener("click", SpeakText);
});
}
// Needed to change between the two audio contexts
var AudioContext = window.AudioContext || window.webkitAudioContext;
// Sets the old style getUserMedia to use the new style that is supported in more browsers even though the framework uses the new style
window.navigator.getUserMedia = function (constraints, successCallback, errorCallback) {
window.navigator.mediaDevices.getUserMedia(constraints)
.then(function (e) {
successCallback(e);
})
.catch(function (e) {
errorCallback(e);
});
};
The text was updated successfully, but these errors were encountered:
I am using the direct line with the code below. I have speech recognition working with IOs but when a response with the input hint set to expecting input comes back, speech recognition becomes unusable until I send something back. This often happens with
PromptDialog.Confirm
. Since IOs does not allow audio recording unless done from a direct user tap/click, I am guessing the problem is with the speech recognizer trying to start recording audio but it can't.The text was updated successfully, but these errors were encountered: