[英]Using Web Audio API Ionic 2
I am having problems with using the Web Audio API in ionic 2. No matter what I try I get errors. 我在ionic 2中使用Web Audio API时遇到问题。无论尝试什么,都会出现错误。 What I have gathered is that it is a problem with the typescript compiler.
我收集到的是打字稿编译器有问题。 And tried adding the "es2015.promise", but did not work.
并尝试添加“ es2015.promise”,但没有成功。 I get the error message:
我收到错误消息:
Property 'catch' does not exist on type 'PromiseLike<void>'.
L10: .then(function () { console.log("Accepted")})
L11: .catch(function () { console.log("Rejected"); });
my code looks like 我的代码看起来像
this.audio = navigator.mediaDevices.getUserMedia({ audio: true })
.then(function () { console.log("Accepted")})
.catch(function () { console.log("Rejected"); });
I found the answer to my question, I ended up downloading the Visual Studio 2017 Release Candidate to get a newer version of intellisense. 我找到了问题的答案,最终我下载了Visual Studio 2017 Release Candidate以获取更新版本的intellisense。 Found I could not use javascript's catch.
发现我无法使用javascript的捕获。 So the code ended up looking like.
因此,代码最终看起来像。
this.audio = navigator.mediaDevices.getUserMedia({ audio: true }).then((stream)=>{console.log(stream);}, (err) => { console.log(err); })
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.