Reputation: 243
I have been trying to get this tutorial working in Angular2. The problem I am facing is getting navigator.mediaDevices.getUserMedia working. The issue is that mediaDevices does not exist on type 'navigator'.
Here is the media capture and stream documentation.
I'd like to link more information but I do not yet have the reputation. However, the DefinitelyTyped MediaStream.d.ts is the other resource I've been using.
I hope to get this working by the end of the week, if I get the solution I will post an example on GitHub. Any help is greatly appreciated, thank you!
Upvotes: 1
Views: 8554
Reputation: 243
I got it working in a single .ts file, here is the GitHub example. To navigate directly to the example file go to src/app/example/example.component.ts
To solve the problem I went the object-oriented route. i.g.
var n = <any>navigator;
n.getUserMedia = ( n.getUserMedia || n.webkitGetUserMedia || n.mozGetUserMedia || n.msGetUserMedia );
Upvotes: 7