Getting frustrated, need help with typings install


#1

So here’s the deal. I have a project that is using getUserMedia.

I have an ionic project that is literally just the starter project at this point and I am running a fresh install of ionic, nodejs, npm etc. It compiles and runs alright and I changed the big blue menu button to start recording the user’s camera and mic, using the demo code from webrtc which works fine in regular js (sans angular & ionic).

To get to the point it would compile I had to change all of my navigator.mediaDevices calls to (navigator).mediaDevices
However the promise is never returning.

After hours googling it I finally found typings that seem to match it over here…
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/webrtc

The best instructions I can find say that to install this I need to execute…
typings install --save --ambient webrtc

When I try that I get an error message stating that ambient is deprecated and to use global instead.
So I used global and now I get the error
typings ERR! message Unable to find “webrtc” (“npm”) in the registry.

Yet it’s right there I’m looking right at it over in github.

What am I doing wrong here??? How do we install and use typings for things like this?
Thanks for your information.


#2

Hello @digame

Typings for webrtc is distributed as two separate packages. One is webrtc/mediastream and the other is webrtc/rtcpeerconnections. Running the command typings search webrtc will actually show you all the available typings packages including the source of the package. Please use the relevant package that has the typings you are looking for by running either typings install dt~webrtc/mediastream --save --global or typings install dt~webrtc/rtcpeerconnection --save --global. The attached image shows the result of all the mentioned commands.

One important thing to note is the issue that you are facing is nothing to do with ionic 2 itself.

Regards
Vijay