我正在使用@opentok/client
为简单的多用户视频聊天构建 Angular6 应用程序。
我想做一个“聚光灯”(例如,全屏用户当前在会话中说话)功能hark.js
用于语音检测。
问题是这个库需要源MediaStream
来处理音频并发出我要捕获和处理的事件。
我想MediaStream
从 OpenTok 的订阅者类中获取,但是如何做到这一点却无处可寻,但由于它基于常见的 WebRTC,它应该是可行的。
有什么线索吗?
示例代码:
this.opentokService.initSession().then((session: OT.Session) => {
this.session = session;
this.session.on('streamCreated', (event) => {
this.streams.push(event.stream); //creates the subscribers elements
var speechEvents = hark(event.stream, {}); //raises error, how to get a proper MediaStream here?
});