From 250cd77603b4f4b60eb3b55527e26c7cb0749ef9 Mon Sep 17 00:00:00 2001 From: netpro2k <netpro2k@gmail.com> Date: Tue, 14 Nov 2017 14:52:43 -0800 Subject: [PATCH] Add a simple loading spinner while connecting --- public/room.html | 18 ++++++++++++++---- src/index.js | 4 ++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/public/room.html b/public/room.html index bb54e9b9b..ebf02d3de 100644 --- a/public/room.html +++ b/public/room.html @@ -4,20 +4,30 @@ <title>Mozilla Mixed Reality Social Client</title> <script src="./app.bundle.js"></script> <style> - .a-enter-vr { - top: 90px; - bottom: auto; - } + .a-enter-vr { + top: 90px; + bottom: auto; + } + #loader { + position: fixed; + width: 100vw; + height: 100vh; + z-index: 10001; + background: #eaeaea no-repeat url(assets/loading.gif) center center; + opacity: 0.9; + } </style> </head> <body> + <div id="loader"></div> <a-scene networked-scene="adapter: janus; room: 2; serverURL: wss://quander.me:8989; audio: true; debug: true; + onConnect: onConnect; connectOnLoad: false;" mute-mic="eventSrc: a-scene; toggleEvents: action_mute"> diff --git a/src/index.js b/src/index.js index e7c77842e..a7fa48d08 100644 --- a/src/index.js +++ b/src/index.js @@ -56,3 +56,7 @@ window.onSceneLoad = function() { scene.components["networked-scene"].connect(); }; + +window.onConnect = function() { + document.getElementById("loader").style.display = "none"; +}; -- GitLab