Updating
This commit is contained in:
+2
-2
@@ -48,7 +48,7 @@ System.Text.RegularExpressions.Regex.IsMatch(userAgent, @"MSIE \d|Trident.*rv:")
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
<script src="_content/Blazored.Typeahead/blazored-typeahead.js"></script>
|
||||
<script src="js/microsoft.cognitiveservices.speech.sdk.bundle.js"></script>
|
||||
<script src="js/SpeechFunctions.js"></script>
|
||||
<script src="js/microsoft.cognitiveservices.speech.sdk.bundle.js" asp-append-version="true"></script>
|
||||
<script src="js/SpeechFunctions.js" asp-append-version="true"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+19
-6
@@ -46,18 +46,31 @@ function synthesizeSpeech(subscriptionKey, region, endpoint, ssml) {
|
||||
}
|
||||
|
||||
function createSpeechConfig(SpeechSDK, subscriptionKey, region, endpoint) {
|
||||
const trimmedRegion = typeof region === "string" ? region.trim() : "";
|
||||
const trimmedEndpoint = typeof endpoint === "string" ? endpoint.trim() : "";
|
||||
const trimmedRegion = typeof region === "string" ? region.trim() : "";
|
||||
|
||||
if (trimmedRegion) {
|
||||
if (!trimmedEndpoint) {
|
||||
return SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey, trimmedRegion);
|
||||
}
|
||||
}
|
||||
|
||||
if (trimmedEndpoint) {
|
||||
const endpointUrl = new URL(trimmedEndpoint);
|
||||
const hasCustomPath = endpointUrl.pathname && endpointUrl.pathname !== "/";
|
||||
|
||||
if (hasCustomPath) {
|
||||
return SpeechSDK.SpeechConfig.fromEndpoint(endpointUrl, subscriptionKey);
|
||||
}
|
||||
|
||||
return SpeechSDK.SpeechConfig.fromHost(endpointUrl, subscriptionKey);
|
||||
}
|
||||
|
||||
if (trimmedRegion) {
|
||||
return SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey, trimmedRegion);
|
||||
}
|
||||
|
||||
if (trimmedEndpoint) {
|
||||
return SpeechSDK.SpeechConfig.fromEndpoint(new URL(trimmedEndpoint), subscriptionKey);
|
||||
}
|
||||
|
||||
throw new Error("Speech configuration is missing both region and endpoint.");
|
||||
throw new Error("Speech configuration is missing both endpoint and region.");
|
||||
}
|
||||
|
||||
function buildSynthesisErrorMessage(SpeechSDK, result, region, endpoint) {
|
||||
|
||||
Reference in New Issue
Block a user