Uncaught TypeError: AWS.TranscribeService is not a constructor
Uncaught TypeError: AWS.TranscribeService is not a constructor
我正在尝试通过我网页上的 JavaScript SDK 访问 AWS Transcribe API,以实施示例文本到语音 Web 应用程序。我参考了 AWS 网站上的文档,包括生成 CognitoIdentityCredentials
。
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.653.0.min.js"></script>
<script type="text/javascript">
debugger;
AWS.config = new AWS.Config({
access_key_id: 'xxxxx',
secretAccessKey: 'xxxx',
region: 'us-east-2'
});
// Initialize the Amazon Cognito credentials provider
AWS.config.region = 'us-east-2'; // Region
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'us-east-2:xx-xx-xxxx-xxxx-xxx',
});
console.log(AWS);
debugger;
var transcribeservice = new AWS.TranscribeService();
</script>
错误
为 JavaScript 创建您自己的 AWS SDK 构建的最简单方法是使用位于 https://sdk.amazonaws.com/builder/js 的 SDK 构建器 Web 应用程序。使用 SDK 构建器指定要包含在您的构建中的服务及其 API 版本。
选择Select所有服务或选择Select默认服务作为起点,您可以添加或删除服务。选择 Development 以获得更易读的代码,或选择 Minified 创建要部署的缩小版本。选择要包含的服务和版本后,选择 Build 构建并下载您的自定义 SDK。
我正在尝试通过我网页上的 JavaScript SDK 访问 AWS Transcribe API,以实施示例文本到语音 Web 应用程序。我参考了 AWS 网站上的文档,包括生成 CognitoIdentityCredentials
。
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.653.0.min.js"></script>
<script type="text/javascript">
debugger;
AWS.config = new AWS.Config({
access_key_id: 'xxxxx',
secretAccessKey: 'xxxx',
region: 'us-east-2'
});
// Initialize the Amazon Cognito credentials provider
AWS.config.region = 'us-east-2'; // Region
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'us-east-2:xx-xx-xxxx-xxxx-xxx',
});
console.log(AWS);
debugger;
var transcribeservice = new AWS.TranscribeService();
</script>
错误
为 JavaScript 创建您自己的 AWS SDK 构建的最简单方法是使用位于 https://sdk.amazonaws.com/builder/js 的 SDK 构建器 Web 应用程序。使用 SDK 构建器指定要包含在您的构建中的服务及其 API 版本。
选择Select所有服务或选择Select默认服务作为起点,您可以添加或删除服务。选择 Development 以获得更易读的代码,或选择 Minified 创建要部署的缩小版本。选择要包含的服务和版本后,选择 Build 构建并下载您的自定义 SDK。