Closed d3b00 closed 6 years ago
I closed this because it was an empty ticket with just the letter "E" as the title, but you edited it to add info so I'll reopen.
Yeah I did that by mistake. What about the issue though, is rtc-everywhere not supported in android?
@d3b00 Should work fine on android, will look into it. Can you post the code you're using?
Node.js is embedded in my android app and whenever I try to create a peer I get this error
@d3b00 Yep I need to see your code, it sounds like the issue is with the usage and not rtc-everywhere itself.
this is my code:
const rtc = require('rtc-everywhere')();
const Peer = require('simple-peer');
console.log(rtc.supported); // prints false on Android and true on Windows
const p1 = new Peer({ wrtc: rtc, initiator: true });
And this is the error: /files/nodejs-project/node_modules/simple-peer/index.js:82 self._pc = new (self._wrtc.RTCPeerConnection)(self.config, self.constraints) ^
TypeError: self._wrtc.RTCPeerConnection is not a constructor
at new Peer (/files/nodejs-project/node_modules/simple-peer/index.js:82:14)
at Object.
@d3b00 If you log the rtc
object what does it show?
In Android
{
platform: 'node',
supported: false,
getUserMedia: [Function],
RTCPeerConnection: undefined,
RTCSessionDescription: undefined,
RTCIceCandidate: undefined,
attachStream: [Function]
}
On Windows
{
platform: 'node',
supported: true,
getUserMedia: [Function],
RTCPeerConnection: [Function: RTCPeerConnection],
RTCSessionDescription: [Function: RTCSessionDescription],
RTCIceCandidate: [Function: RTCIceCandidate],
attachStream: [Function]
}
This is in an android emulator? Interesting, so it looks like the bug is that its identifying your emulator as node and then failing to load the node library because that is node-specific.
Is this in cordova or some other framework? What does typeof window
log?
well but that is the expected behavior. It should be treated like Node. As I said "Node.js is embedded in my android app" and I am running it in that embedded Node.js and all my other files where I have imported other modules like async, md5, etc are working fine so I guess Node.js is correctly configured.
Ah I see the issue - you need to install the wrtc
module. Documented here: https://github.com/contra/rtc-everywhere#other
Let me know if that doesn't work and I'll reopen.
wrtc is already installed. I was working with wrtc and simple-peer when I was not using WebRTC on Android but now I need it to work on Android and wrtc only supports x64 architecture that's why I installed rtc-everywhere.
But yeah, wrtc is already installed.
@d3b00 rtc-everywhere
uses wrtc
for the webrtc bindings for node. If wrtc
directly doesn't work for you then neither will rtc-everywhere
- sorry. As far as I know wrtc
is the only node binding available.
but I think wrtc is not working because it doesn't support Android architecture. Isn't rtc-everywhere specifically built to provide support for incompatible architectures/environments?
@d3b00 rtc-everywhere exists to provide a nice abstraction/normalization across JS environments (and libraries), so one codebase will work everywhere regardless of the browser or mobile JS framework. Our target was never non-JS apps. If you have issues with node-webrtc
not working on your environment you should open a ticket on that repository.
If you're building a native android app you would be better off using the standard java webrtc bindings than embedding node and using rtc-everywhere. I've updated our docs to reflect the limitations of the wrtc
module.
Well you're probably right, should use java webrtc bindings. thanks for your time tho :+1:
Works on Windows.
But when I try to run in Android: supported: false error: self._wrtc.RTCPeerConnection is not a constructor both in actual phone and emulator.