TypeError: Illegal invocation when using Media calls demo
See original GitHub issueHi @peers @michellebu I’m trying to use peerjs in my angularjs application. While trying to use the code for media call in your example,
var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
getUserMedia({video: true, audio: true}, function(stream) {
var call = peer.call('another-peers-id', stream);
call.on('stream', function(remoteStream) {
// Show stream in some <video> element.
});
}, function(err) {
console.log('Failed to get local stream' ,err);
});
I got an error message like this: TypeError: Illegal invocation...
But if I try to use it like this, it works just fine.
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
navigator.getUserMedia({video: true, audio: true}, function(stream) {
var call = peer.call('another-peers-id', stream);
call.on('stream', function(remoteStream) {
// Show stream in some <video> element.
});
}, function(err) {
console.log('Failed to get local stream' ,err);
});
Not sure if this is related to the browser navigator api or just an angularjs issues. Do you have any idea? Thanks.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:5
- Comments:7 (1 by maintainers)
Top Results From Across the Web
"Uncaught TypeError: Illegal invocation" in Chrome
In your code you are assigning a native method to a property of custom object. When you call support.animationFrame(function () {}) , it...
Read more >Illegal invocation" error thrown in js-agent.newrelic.com ...
We have a PHP integration with New Relic in our SAAS application, ... TypeError: Illegal invocation (Most recent call first) File ...
Read more >"Illegal invocation" errors in JavaScript - Matias Kinnunen
An "illegal invocation" error is thrown when calling a function whose this keyword doesn't refer to the object where it originally did. In...
Read more >"Uncaught TypeError: Illegal invocation" on click handler
produces this error. Seems like a bug, either in highcharts or jquery. I'm using jQuery version 1.6.2 and HighCharts version 2.1.6.
Read more >TypeError: 'open' called on an object that does not implement ...
Uncaught TypeError: illegal Invocation ... rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

these sort of function needs navigator as its context. so with bind we can simply solve the problem.
By the way, this issue is still in the media section of http://peerjs.com