diff --git a/client/src/App.js b/client/src/App.js index 2f4de51..bf42f84 100755 --- a/client/src/App.js +++ b/client/src/App.js @@ -46,6 +46,7 @@ const Table = () => { const data = JSON.parse(event.data); switch (data.type) { case 'game-update': + console.log(`ws: message - ${data.type}`, data.update); if ('name' in data.update && data.update.name !== name) { console.log(`Updating name to ${data.update.name}`); setName(data.update.name); diff --git a/client/src/MediaControl.css b/client/src/MediaControl.css index d7f6afe..1349b5f 100644 --- a/client/src/MediaControl.css +++ b/client/src/MediaControl.css @@ -1,6 +1,6 @@ .MediaAgent { position: absolute; - display: flex; + display: none; top: 0; left: 0; z-index: 50000; diff --git a/client/src/MediaControl.js b/client/src/MediaControl.js index f383c41..237e186 100644 --- a/client/src/MediaControl.js +++ b/client/src/MediaControl.js @@ -278,13 +278,15 @@ const MediaAgent = () => { return; } let update = false; - if (!(name in peers)) { - update = true; - peers[name] = { - local: true, - attributes: { - } - }; + if (stream) { + if (!(name in peers)) { + update = true; + peers[name] = { + local: true, + attributes: { + } + }; + } } for (let key in peers) { @@ -297,14 +299,14 @@ const MediaAgent = () => { console.log(`MediaAgent - Adding local`, peers); setPeers(Object.assign({}, peers)); } - }, [peers, name, setPeers]); + }, [peers, name, setPeers, stream]); - useEffect(() => { + useEffect(async () => { if (!ws) { return; } - const setup_local_media = async () => { + const setup_local_media = () => { /* Ask user for permission to use the computers microphone and/or camera, * attach it to an