From 4fce3f44860393f6ac1eb79f3b874acaba824519 Mon Sep 17 00:00:00 2001 From: Greg Fodor <gfodor@gmail.com> Date: Sun, 21 Oct 2018 19:19:05 +0000 Subject: [PATCH] Media component type --- src/gltf-component-mappings.js | 11 +++++------ src/hub.js | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gltf-component-mappings.js b/src/gltf-component-mappings.js index d8a318f3c..c2a29577f 100644 --- a/src/gltf-component-mappings.js +++ b/src/gltf-component-mappings.js @@ -73,10 +73,9 @@ AFRAME.GLTFModelPlus.registerComponent("nav-mesh", "nav-mesh", (el, _componentNa el.setAttribute("nav-mesh"); }); -AFRAME.GLTFModelPlus.registerComponent("networked", "networked", (el, componentName, componentData) => { - // Mark this to act as a "full sync" from the GLTF scene itself, to avoid taking ownership. - componentData.isFirstSync = true; - componentData.components = []; - console.log(componentData); - NAF.connection.entities.updateEntity(componentData.owner, "u", componentData); +AFRAME.GLTFModelPlus.registerComponent("media", "media", (el, componentName, componentData) => { + // TODO compute a network id based upon URL and transform + const networkId = "foo"; + el.setAttribute("networked", { template: "#interactable-media", owner: "scene", networkId }); + el.setAttribute("media-loader", { resize: true, resolve: true, src: componentData.src }); }); diff --git a/src/hub.js b/src/hub.js index 7299836c6..2fd06d771 100644 --- a/src/hub.js +++ b/src/hub.js @@ -246,7 +246,7 @@ async function handleHubChannelJoined(entryManager, hubChannel, data) { const environmentScene = document.querySelector("#environment-scene"); const objectsScene = document.querySelector("#objects-scene"); const objectsUrl = - "https://farspark-dev.reticulum.io/0/raw/0/0/0/0/aHR0cHM6Ly91cGxvYWRzLWRldi5yZXRpY3VsdW0uaW8vZmlsZXMvMDAxODQ0NmEtY2NjMi00ODczLTkwMDItM2VkZmI4NzEzZTRmLmdsdGY_dG9rZW49MjVmOTVkMjhkODY1NzJhMjRhOTI4ZjJiNDExZTQ1YWE"; + "https://farspark-dev.reticulum.io/0/raw/0/0/0/0/aHR0cHM6Ly91cGxvYWRzLWRldi5yZXRpY3VsdW0uaW8vZmlsZXMvNTQ4NTBlNjUtNzhlMi00MjAyLTkzMjItMzk2YmFlZDQ4MTJhLmdsdGY_dG9rZW49NzA2YzdkMjM1OGM0MDIxYzVjOGU2MmIzNGM5MDZiZDY"; const objectsEl = document.createElement("a-entity"); objectsEl.setAttribute("gltf-model-plus", { src: objectsUrl, useCache: false, inflate: true }); objectsScene.appendChild(objectsEl); -- GitLab