new Audio() gives "Unresolved type Audio" in JavaScript

Hi.

My code with the HTML 5 Audio API works without problem, but IntelliJ gives a "Unresolved type Audio" when I write: 

var a = new Audio("http://test.com/test.mp3")

I've tried to follow this post, but looks like webaudioapi library isn't available anymore.

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206317049-AudioContext-not-resolved-?sort_by=votes

I don't want to turn off the warning, I want to somehow make IntelliJ find HTML5 Audio API.

How can I do that?

Thanks!

0

Hi there,

Try www.npmjs.com/package/@types/webaudioapi instead (if you need that package referenced in your link).

Thing is: I'm not sure if that will help .. as I do not see any "Audio" defined there  -- only "AudioContext" (http://definitelytyped.org/docs/webaudioapi--waa/globals.html)

 

On related note: https://youtrack.jetbrains.com/issue/WEB-24869

1
Avatar
Permanently deleted user

Yea, you're right.

Isn't the Web Audio API. Looks like a JS shortcut function to create an HTML <audio> element.

I saw in the first response here: https://stackoverflow.com/questions/9419263/playing-audio-with-javascript

But I still don't have a clue on how to get rid of the warning.

Thanks for your answer anyway.

0

It's indeed a known issue: https://youtrack.jetbrains.com/issue/WEB-24869. Please vote for it to increase its priority and to be notified about updates.

1
Avatar
Permanently deleted user

Done. Thanks for the clarification.

0

请先登录再写评论。