Commit 72d97db2 authored by marioromera's avatar marioromera
Browse files

fix signal from

parent 98190c9c
......@@ -124,12 +124,13 @@ const answerButton = document.querySelector('button.answer-try');
answerButton.addEventListener('click', tryAnswer);
export function drawOffer(offer) {
console.log('draw offer', offer);
let offerEl;
if (!offer.from || !state.socket) {
offerEl = document.querySelector(`.offer-copy`);
} else {
offerEl = document.querySelector(
`.offer-${offer.from === state.socket.id ? 'paste' : 'copy'}`
`.offer-${offer.from === state.socket.id ? 'copy' : 'paste'}`
);
}
......
......@@ -16,6 +16,7 @@ export function createPeer({ id, initiator }) {
console.log('Creating peer', id, initiator);
const peer = new Peer({
initiator,
trickle: process.env.NODE_ENV === 'production',
});
peer.id = id || peer._id;
......@@ -96,7 +97,9 @@ export function addListenerToPeerEvents(id) {
// or an answer
peer.on('signal', (signal) => {
signal.from = id;
if (!state.socket) {
signal.from = id;
}
console.log('Peer signal', signal.type);
const { type } = signal;
if (type) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment