I attempted to integrate webrtc into my Angular 2 TypeScript project and encountered the following error: navigation.getUserMedia is not a function.
Below is the code I used:
ngOnInit(): void {
navigator.getUserMedia(this.constraints,
stream => {
var track: MediaStreamTrack = stream.getTracks()[0];
console.log('label:' + track.label);
console.log('ended:' + track.readyState);
track.onended = (event:Event) => console.log('Track ended');
var objectUrl = URL.createObjectURL(stream);
},
error => {
console.log('Error message: ' + error.message);
console.log('Error name: ' + error.name);
});
}
You can view the code on Plunker here.
If anyone has any advice or solutions, please let me know.