Я пытаюсь подключить свой ноутбук и мобильное устройство с помощью Peer JS
Сначала я запускаю электронное приложение на своем ноутбуке, генерирую идентификатор и передаю его моему ответу родное приложение, которое затем пытается подключиться нажатием кнопки.
Рабочий стол
const webPeer = new Peer({host: ip, port: 8090, path: '/peer', debug: 2});
var webId;
webPeer.on('error', function(error) {
console.log("I NEVER SEE THIS", error);
});
webPeer.on('open', async (id) => {
// I pass this to the phone here - works fine and I see the console log on the line below
console.log("Saved Web ID", webId);
webPeer.on('call', function(call) {
console.log("Getting call from mobile");
call.answer(stream);
});
}); // I Never get any messages in the console for disconnected or 'close' events
webPeer.on('disconnected', function() {
console.log('Disconnection on web...');
// update app to show disconnected error
});
webPeer.on('close', function() {
console.log('Closing...');
// update app to show disconnected error
});
Мобильный
const mobPeer = new Peer({
host: ipv4, secure: false, port: 8090, path: '/peer', debug: 1
});
mobPeer.connect(webId);
mobPeer.on('open', function(id) {
// I see this in the console
console.log('Mobile id is', id);
});
// I never see any of the below events appear in the console
mobPeer.on('call', function(call) {
console.log("Got remote stream", call);
call.answer(null);
});
mobPeer.on('disconnected', function() {
console.log('Disconnection on web...');
// update app to show disconnected error
});
mobPeer.on('close', function() {
console.log('Closing...');
// update app to show disconnected error
});
Когда я пытаюсь подключиться => call => answer, я получаю это в консоли приложения для электроники / компьютера:
Connected
Connected
OFFER from r7a3vxg2q4000000 to qre0pfj8zin00000
CANDIDATE from r7a3vxg2q4000000 to qre0pfj8zin00000
CANDIDATE from r7a3vxg2q4000000 to qre0pfj8zin00000
CANDIDATE from r7a3vxg2q4000000 to qre0pfj8zin00000
CANDIDATE from r7a3vxg2q4000000 to qre0pfj8zin00000
CANDIDATE from r7a3vxg2q4000000 to qre0pfj8zin00000
CANDIDATE from r7a3vxg2q4000000 to qre0pfj8zin00000
CANDIDATE from r7a3vxg2q4000000 to qre0pfj8zin00000
CANDIDATE from r7a3vxg2q4000000 to qre0pfj8zin00000
CANDIDATE from r7a3vxg2q4000000 to qre0pfj8zin00000
[20580:0116/033646.215:ERROR:audio_rtp_receiver.cc(88)] AudioRtpReceiver::OnSetVolume: No audio channel exists.
ANSWER from qre0pfj8zin00000 to r7a3vxg2q4000000
CANDIDATE from qre0pfj8zin00000 to r7a3vxg2q4000000
ERROR PeerServer: Message unrecognized
ERROR PeerServer: Message unrecognized
ERROR PeerServer: Message unrecognized
ERROR PeerServer: Message unrecognized
ERROR PeerServer: Message unrecognized