Skip to content

Commit 9bfeb4d

Browse files
author
Avaer Kazmer
committed
Add live model change support
1 parent 57d7aff commit 9bfeb4d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

vrarmik.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,10 @@ <h3>Multiplayer</h3>
525525
const model = await _loadModelUrl(href);
526526
_setLocalModel(model);
527527
modelUrl = href;
528+
_sendAllPeerConnections(JSON.stringify({
529+
method: 'model',
530+
url: modelUrl,
531+
}));
528532
});
529533
}
530534

@@ -984,6 +988,11 @@ <h3>Multiplayer</h3>
984988

985989
let channelConnection = null;
986990
const peerConnections = [];
991+
const _sendAllPeerConnections = s => {
992+
for (let i = 0; i < peerConnections.length; i++) {
993+
peerConnections[i].send(s);
994+
}
995+
};
987996
const channelInput = document.getElementById('channel-input');
988997
const connectButton = document.getElementById('connect-button');
989998
connectButton.addEventListener('click', () => {
@@ -1243,6 +1252,10 @@ <h3>Multiplayer</h3>
12431252
const model = await _loadModelUrl(url);
12441253
_setLocalModel(model);
12451254
modelUrl = url;
1255+
_sendAllPeerConnections(JSON.stringify({
1256+
method: 'model',
1257+
url: modelUrl,
1258+
}));
12461259
})();
12471260
</script>
12481261
</body>

0 commit comments

Comments
 (0)