Updating
This commit is contained in:
+13
-6
@@ -214,12 +214,19 @@
|
||||
return;
|
||||
}
|
||||
|
||||
await JSRuntime.InvokeVoidAsync(
|
||||
"synthesizeSpeech",
|
||||
spitConfiguration.SpeechApiKey,
|
||||
spitConfiguration.Region,
|
||||
spitConfiguration.ResolveSpeechSdkEndpointUri()?.ToString(),
|
||||
_textToSpeech.Ssml);
|
||||
try
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync(
|
||||
"synthesizeSpeech",
|
||||
spitConfiguration.SpeechApiKey,
|
||||
spitConfiguration.Region,
|
||||
spitConfiguration.ResolveSpeechSdkEndpointUri()?.ToString(),
|
||||
_textToSpeech.Ssml);
|
||||
}
|
||||
catch (Microsoft.JSInterop.JSException)
|
||||
{
|
||||
toastService.ShowError("Unable to load the speech playback SDK in the browser. Disable content blocking for this site or reload and try again.");
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenDirectory(string fileDestination)
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ namespace LCU.Webapps.Marketing.SPIT.Services
|
||||
try
|
||||
{
|
||||
var speechConfig = BuildSpeechConfig();
|
||||
speechConfig.SetSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm);
|
||||
speechConfig.SpeechSynthesisVoiceName = textToSpeech.SelectedVoiceShortName;
|
||||
var finalDestination = (_spitConfiguration.FileDestination ?? string.Empty).Trim();
|
||||
if (string.IsNullOrWhiteSpace(finalDestination))
|
||||
|
||||
+8
-7
@@ -1,14 +1,15 @@
|
||||
function synthesizeSpeech(subscriptionKey, region, endpoint, ssml) {
|
||||
var SpeechSDK;
|
||||
if (!!window.SpeechSDK) {
|
||||
SpeechSDK = window.SpeechSDK;
|
||||
const speechSdk = window.SpeechSDK;
|
||||
|
||||
if (!speechSdk) {
|
||||
throw new Error("Speech SDK is unavailable. The browser likely blocked the SDK script.");
|
||||
}
|
||||
|
||||
const speechConfig = endpoint
|
||||
? SpeechSDK.SpeechConfig.fromEndpoint(new URL(endpoint), subscriptionKey)
|
||||
: SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey, region);
|
||||
const audioConfig = SpeechSDK.AudioConfig.fromDefaultSpeakerOutput();
|
||||
let synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig, audioConfig);
|
||||
? speechSdk.SpeechConfig.fromEndpoint(new URL(endpoint), subscriptionKey)
|
||||
: speechSdk.SpeechConfig.fromSubscription(subscriptionKey, region);
|
||||
const audioConfig = speechSdk.AudioConfig.fromDefaultSpeakerOutput();
|
||||
let synthesizer = new speechSdk.SpeechSynthesizer(speechConfig, audioConfig);
|
||||
|
||||
synthesizer.speakSsmlAsync(
|
||||
ssml,
|
||||
|
||||
Reference in New Issue
Block a user