小编Joe*_*Joe的帖子

使用AVAudioEngine录制音频文件

我想使用AVAudioEngine录制音频文件.所以它将从麦克风到输出文件.稍后我会添加一些效果.但就目前而言,我只想让它发挥作用.

任何人都可以向我提供步骤或示例代码,以便我可以开始吗?

iphone ios swift

10
推荐指数
1
解决办法
4709
查看次数

EventSource在Angular 4中不起作用

我是Angular 4的新手,我正在尝试创建一个EventSource来订阅和接收事件.我从以下代码开始:

import { Injectable} from '@angular/core';
import { Http } from '@angular/http';

@Injectable()
export class MyService implements OnInit {

  constructor(private http: Http) {
    const eventSource = new EventSource('/events');
    eventSource.onmessage = x => console.log(JSON.parse(x.data));
  }
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

[ts] Cannot find name 'EventSource'.
Run Code Online (Sandbox Code Playgroud)

然后,我添加了以下导入:

import { EventSource } from 'eventsource';
Run Code Online (Sandbox Code Playgroud)

浏览器控制台中出现错误:

Uncaught (in promise): TypeError: 
__WEBPACK_IMPORTED_MODULE_2_eventsource_lib_eventsource_js__.EventSource is not a constructor
Run Code Online (Sandbox Code Playgroud)

我也尝试添加

"eventsource": "1.0.2"
Run Code Online (Sandbox Code Playgroud)

到我的package.json,重新安装使用npm install,启动项目使用npm start,但问题仍然存在.

angular

5
推荐指数
1
解决办法
5051
查看次数

标签 统计

angular ×1

ios ×1

iphone ×1

swift ×1