diff --git a/src/hub.js b/src/hub.js index dc670529c19e2471070f173d68bd187c4ea26bc4..d6aa4580c1f16e296fc0dfd70a619acdc8b62c61 100644 --- a/src/hub.js +++ b/src/hub.js @@ -211,7 +211,7 @@ const onReady = async () => { } }; - const enterScene = async (mediaStream, enterInVR, janusRoomId) => { + const enterScene = async (mediaStream, enterInVR, hubId) => { const scene = document.querySelector("a-scene"); const playerRig = document.querySelector("#player-rig"); document.querySelector("a-scene canvas").classList.remove("blurred"); @@ -226,7 +226,7 @@ const onReady = async () => { document.querySelector("#player-camera").setAttribute("look-controls", ""); scene.setAttribute("networked-scene", { - room: janusRoomId, + room: hubId, serverURL: process.env.JANUS_SERVER }); @@ -380,11 +380,11 @@ const onReady = async () => { }); environmentRoot.appendChild(initialEnvironmentEl); - const setRoom = (janusRoomId, hubName) => { + const setRoom = (hubId, hubName) => { if (!isBotMode) { - remountUI({ janusRoomId, hubName }); + remountUI({ hubId, hubName }); } else { - const enterSceneImmediately = () => enterScene(new MediaStream(), false, janusRoomId); + const enterSceneImmediately = () => enterScene(new MediaStream(), false, hubId); if (scene.hasLoaded) { enterSceneImmediately(); } else { @@ -395,7 +395,7 @@ const onReady = async () => { if (qs.room) { // If ?room is set, this is `yarn start`, so just use a default environment and query string room. - setRoom(qs.room && !isNaN(parseInt(qs.room)) ? parseInt(qs.room) : 1); + setRoom(qs.room || "default"); initialEnvironmentEl.setAttribute("gltf-bundle", { src: DEFAULT_ENVIRONMENT_URL }); @@ -425,7 +425,7 @@ const onReady = async () => { const hub = data.hubs[0]; const defaultSpaceTopic = hub.topics[0]; const gltfBundleUrl = defaultSpaceTopic.assets.find(a => a.asset_type === "gltf_bundle").src; - setRoom(defaultSpaceTopic.janus_room_id, hub.name); + setRoom(hub.hub_id, hub.name); initialEnvironmentEl.setAttribute("gltf-bundle", `src: ${gltfBundleUrl}`); hubChannel.setPhoenixChannel(channel); }) diff --git a/src/react-components/ui-root.js b/src/react-components/ui-root.js index 82c1c911231ed42bd8853895c6f17a147179351f..849cd21eb49d0bf27c4eea7c08d7ad7e2de909bc 100644 --- a/src/react-components/ui-root.js +++ b/src/react-components/ui-root.js @@ -64,9 +64,9 @@ class UIRoot extends Component { showProfileEntry: PropTypes.bool, availableVREntryTypes: PropTypes.object, initialEnvironmentLoaded: PropTypes.bool, - janusRoomId: PropTypes.number, roomUnavailableReason: PropTypes.string, platformUnsupportedReason: PropTypes.string, + hubId: PropTypes.string, hubName: PropTypes.string, occupantCount: PropTypes.number }; @@ -488,7 +488,7 @@ class UIRoot extends Component { screenfull.request(); } - this.props.enterScene(this.state.mediaStream, this.state.enterInVR, this.props.janusRoomId); + this.props.enterScene(this.state.mediaStream, this.state.enterInVR, this.props.hubId); const mediaStream = this.state.mediaStream; @@ -572,7 +572,7 @@ class UIRoot extends Component { ); } - if (!this.props.initialEnvironmentLoaded || !this.props.availableVREntryTypes || !this.props.janusRoomId) { + if (!this.props.initialEnvironmentLoaded || !this.props.availableVREntryTypes || !this.props.hubId) { return ( <IntlProvider locale={lang} messages={messages}> <div className="loading-panel">