node.js - 播放存储在 AWS S3 中的音频文件
问题描述
我已经通过 Nodejs 成功将一些音频文件上传到 AWS,文件 url 也从我的函数返回。我计划将此 url 保存在 MongoDB Atlas 中作为对原始文件的引用,但在此之前,我尝试在我的移动应用程序中播放该文件(来自该 url),但它不会播放。
该文件是.m4a
格式。如何让它在任何移动和网络音频播放器中工作?我对两者都使用颤振。我不想piping, chunking and streaming
手动进行,因为这只是系统的虚拟测试。应用程序中使用的原始文件会大得多。
这是文件网址https://empty-bouquet.s3.af-south-1.amazonaws.com/Dax+-Dear+God.m4a
。谢谢
解决方案
.m4a
audios aren't natively streamed from S3, but after a test I can verify that .mp3
files are. Most browsers will recognize that filetype and render a built-in player for you.
You can convert from one format to another using a lot of free tools. I used Audacity.
And yes, you need to make at least the file public. Or if you're going to do this a lot I would recommend making a bucket policy that makes everything public, no matter what you throw in there.
推荐阅读
- apache-spark - PySpark 在 Parquet 中错误地输出“01/01/0001”和“12/31/9999”
- java - 使用 Spring Data Neo4j 存储数据的有效方法
- python - 用矩阵模拟 for 循环 100 次
- javascript - window.open 一个 HTML 页面并在浏览器中显示页面之前操作其 DOM - AngularJS、JavaScript
- sql - 如何在 SQL 中计算开始和提交之间的时间?
- python - Selenium 打开 geckdriver 错误:NotADirectoryError: [WinError 267] 目录名无效
- python - 给定 pandas 数据框列,如果 X 是字典中的键,如何将嵌套列表中的元素 X 替换为字典中的值?
- javascript - 在javascript中调用一个函数如何设置另一个函数的变量?
- python - 从 dict 中的数据驱动键获取值
- python - 为什么硒不能正确循环?