Amazon Chime 将录音保存到外部源

问题描述

我正在做 amazon chime sdk 录音演示,即 https://github.com/aws-samples/amazon-chime-sdk-recording-demo,录音已正确保存在 S3 Bucket 上,现在我想将录音文件保存在我的服务器上,我相信,我会需要更改此文件 https://github.com/aws-samples/amazon-chime-sdk-recording-demo/blob/master/recording/record.js 调用S3 Bucket方法保存录音文件代码

const timestamp = new Date();
const fileTimestamp = timestamp.toISOString().substring(0,19);
const year = timestamp.getFullYear();
const month = timestamp.getMonth() + 1;
const day = timestamp.getDate();
const hour = timestamp.getUTCHours();
const fileName = `${year}/${month}/${day}/${hour}/${fileTimestamp}.mp4`;
new S3Uploader(BUCKET_NAME,fileName).uploadStream(transcodeStreamToOutput.stdout);

S3 Bucket Class code

/**
 * S3Upload Class
 * Upload a recording artifact to S3
 */
class S3Uploader {
    /**
     * @constructor
     * @param {*} bucket - the S3 bucket name uploaded to
     * @param {*} key - the file name in S3 bucket
     */
    constructor(bucket,key) {
        this.bucket = bucket;
        this.key = key;
        this.s3Uploader = new AWS.S3({ params: { Bucket: bucket,Key: key } });
        console.log(`[upload process] constructed a S3 object with bucket: ${this.bucket},key: ${this.key}`);
    }

    uploadStream(stream) {
        const managedUpload = this.s3Uploader.upload({ Body: stream },(err,data) => {
            if (err) {
                console.log('[stream upload process] - failure - error handling on failure',err);
            } else {
                console.log(`[stream upload process] - success - uploaded the file to: ${data.Location}`);
                process.exit();
            }
        });
        managedUpload.on('httpUploadProgress',function (event) {
            console.log(`[stream upload process]: on httpUploadProgress ${event.loaded} bytes`);
        });
    }
}

现在我想更改此代码 S3Uploader 以将流上传到我的服务器。 有没有人以前做过这个,我真的很感激。谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...