【发布时间】:2017-02-13 11:58:04
【问题描述】:
我正在编写一个需要使用 Web 音频 API 的 Node.js/Express。我注意到由于stackoverflow answer 中解释的原因,这实际上是“不可能的”。但是,我在网上找到了两个在我看来使用 Node.js/Express 以及 Web Audio API 的项目。可以在 here 和 here 找到它们。当我尝试在我的应用程序中做类似的事情时(使用npm start 运行,我收到以下错误:
/Users/user/Documents/STAGE4/PRCO304/RTMC/controllers/workstation/workstation.js:1
(function (exports, require, module, __filename, __dirname) { var context = new AudioContext();
^
ReferenceError: AudioContext is not defined
当我将var context = new AudioContext(); 行更改为window.AudioContext = window.AudioContext 之类的内容时,我收到window 未定义的错误,我理解这是Node.js 的工作原理。
有人可以向我解释一下这两个项目是如何设法将 Web Audio API 与 Node.js/Express 一起使用的,而当我尝试在我的项目中实现类似的东西时却失败了?
提前致谢。
【问题讨论】:
标签: javascript node.js express audio web-audio-api