如何使用nodejs将音频文件上传到服务器?

问题描述 投票:0回答:1

我是这个社区的新手!如何通过nodejs在服务器上发送音频文件,以便我的HTML(服务器上已存在)可以播放它?

html node.js audio html5-audio
1个回答
0
投票

如果您想将音频文件从html前端发送到Nodejs后端,则可以参考以下文章:How to post a file from a form with Axios

如果您只想在html站点中有播放区域,请使用此:

<audio controls>
 <source src="horse.ogg" type="audio/ogg">
 <source src="horse.mp3" type="audio/mpeg">
 Your browser does not support the audio element.
</audio>

Source

您不需要这两种文件格式。源中的路径可以是相对路径(来自您的html文件),也可以是该文件的绝对路径。

我希望这会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.