我试图将Amazon Transcribe Streaming Service与来自Node.js的http2请求一起使用,这是我遵循Streaming request格式的文档链接 。根据此文档,端点为https:// transcribe-streaming。<'region'>。amazonaws.com,但对此URL进行请求将导致未找到URL错误。但是在Java示例中找到的终点为https:// transcribestreaming。''。amazonaws.com,因此对此URL进行请求不会产生任何错误或响应。我正在从us-east-1地区尝试。
这是我正在尝试的代码。
const http2 = require('http2');
var aws4 = require('aws4');
var opts = {
service: 'transcribe',
region: 'us-east-1',
path: '/stream-transcription',
headers:{
'content-type': 'application/json',
'x-amz-target': 'com.amazonaws.transcribe.Transcribe.StartStreamTranscription'
}
}
var urlObj = aws4.sign(opts, {accessKeyId: '<access key>', secretAccessKey: '<aws secret>'});
const client = http2.connect('https://transcribestreaming.<region>.amazonaws.com');
client.on('error', function(err){
console.error("error in request ",err);
});
const req = client.request({
':method': 'POST',
':path': '/stream-transcription',
'authorization': urlObj.headers.Authorization,
'content-type': 'application/json',
'x-amz-content-sha256': 'STREAMING-AWS4-HMAC-SHA256-EVENTS',
'x-amz-target': 'com.amazonaws.transcribe.Transcribe.StartStreamTranscription',
'x-amz-date': …Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的应用程序中的音频和视频内容生成波形,当前使用 Angular 6 和 TypeScript。我可以使用wavesurfer.js 制作波形,但我无法让时间线插件工作。在我的 angular.json 中,我有这样的脚本
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/popper.js/dist/umd/popper.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js",
"node_modules/moment/min/moment.min.js",
"node_modules/wavesurfer.js/dist/wavesurfer.js",
"node_modules/wavesurfer.js/dist/plugin/wavesurfer.timeline.js"
]
Run Code Online (Sandbox Code Playgroud)
在我的 component.ts 文件中我有类似的代码
declare var WaveSurfer;
declare var TimelinePlugin;
export class TranscriptComponent implements OnInit {
ngAfterViewInit() {
this.wavesurfer = WaveSurfer.create({
container: '#waveform',
waveColor: 'violet',
progressColor: 'purple',
cursorColor: '#d9fb36',
normalize: true,
skipLength: 15,
hideScrollbar: true,
backend: 'MediaElement',
plugins: [
TimelinePlugin.create({
// plugin options ...
})
]
});
}
Run Code Online (Sandbox Code Playgroud)
如果没有插件,我可以获得波形,但如果我尝试添加插件,我会收到错误“TimelinePlugin 未定义”。谁能告诉我如何使用打字稿使用这些插件。一个例子就太好了。
我正在尝试为s3中的存储桶实施aws sns服务,并且我正在按照此文档https://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html进行操作, 根据该文档中将包含订阅网址确认订阅的请求将进入我们提供的网址,但我在请求中收到空白内容。我试图记录尸体,但给了我一个空的物体。并尝试使用bodyparser,但结果相同。
这是我正在实施的路线。
router.post("/s3FileCallback", function (req, res) {
debugger;
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json())
if (req.get("x-amz-sns-message-type") == "SubscriptionConfirmation") {
console.log("arn" + req.get("x-amz-sns-topic-arn"));
const subscribeUrl = req.body.SubscribeURL;
console.log("subscribeUrl" + subscribeUrl);
})
Run Code Online (Sandbox Code Playgroud)
有什么我想念的吗?谁能指出我正确的方向。