Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
authorizationToken: onDemandAuthorizationToken ? () => {
console.log('On-demand fetching Bing Speech authorization token');
try {
return fetchBingSpeechAuthorizationToken(bingSpeechSubscriptionKey);
} catch (err) {
console.error('Failed to fetch Bing Speech authorization token', err);
}
} : null,
subscriptionKey: onDemandAuthorizationToken ? null : bingSpeechSubscriptionKey
export default async function createCognitiveServicesBingSpeechPonyfillFactory({
authorizationToken,
subscriptionKey
}) {
const ponyfill = await createPonyfill({ authorizationToken, subscriptionKey });
const { SpeechGrammarList, speechSynthesis, SpeechSynthesisUtterance } = ponyfill;
return ({ referenceGrammarID }) => ({
SpeechGrammarList,
SpeechRecognition: injectReferenceGrammarID(ponyfill, referenceGrammarID),
speechSynthesis,
SpeechSynthesisUtterance
});
}
return ({ referenceGrammarID }) => {
const ponyfill = createPonyfill({
audioConfig,
authorizationToken,
enableTelemetry,
referenceGrammars: [`luis/${referenceGrammarID}-PRODUCTION`],
region,
speechRecognitionEndpointId,
speechSynthesisDeploymentId,
speechSynthesisOutputFormat,
subscriptionKey,
textNormalization
});
const { SpeechGrammarList, SpeechRecognition, speechSynthesis, SpeechSynthesisUtterance } = ponyfill;
return {
SpeechGrammarList,