diff --git a/src/avatar-selector.js b/src/avatar-selector.js index ea3ff71a0f1f225cb9ae9f68a813167125bc3207..9f5aabab2417584d33a1d6eb43f75503a0212631 100644 --- a/src/avatar-selector.js +++ b/src/avatar-selector.js @@ -10,7 +10,6 @@ import "./vendor/GLTFLoader"; import "./components/animation-mixer"; import "./components/audio-feedback"; import "./components/loop-animation"; -import "./elements/a-progressive-asset"; import "./gltf-component-mappings"; import { avatars } from "./assets/avatars/avatars"; diff --git a/src/elements/a-progressive-asset.js b/src/elements/a-progressive-asset.js deleted file mode 100644 index db51b9b74484043a1f83847cc64d4ccc4bc6554c..0000000000000000000000000000000000000000 --- a/src/elements/a-progressive-asset.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Modified version of a-asset-item that adds high-src and low-src options - * Extracted from https://github.com/aframevr/aframe/blob/master/src/core/a-assets.js - */ - -AFRAME.registerElement("a-progressive-asset", { - prototype: Object.create(AFRAME.ANode.prototype, { - createdCallback: { - value() { - this.data = null; - this.isAssetItem = true; - } - }, - - attachedCallback: { - value() { - if (!this.parentNode.fileLoader) { - throw new Error("a-progressive-asset must be the child of an a-assets element."); - } - - this.fileLoader = this.parentNode.fileLoader; - - const self = this; - const fallbackSrc = this.getAttribute("src"); - const highSrc = this.getAttribute("high-src"); - const lowSrc = this.getAttribute("low-src"); - - let src = fallbackSrc; - - if (window.APP.quality === "high") { - src = highSrc; - } else if (window.APP.quality === "low") { - src = lowSrc; - } - - this.fileLoader.setResponseType(this.getAttribute("response-type")); - this.fileLoader.load( - src, - function handleOnLoad(response) { - self.data = response; - /* - Workaround for a Chrome bug. If another XHR is sent to the same url before the - previous one closes, the second request never finishes. - setTimeout finishes the first request and lets the logic triggered by load open - subsequent requests. - setTimeout can be removed once the fix for the bug below ships: - https://bugs.chromium.org/p/chromium/issues/detail?id=633696&q=component%3ABlink%3ENetwork%3EXHR%20&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified - */ - setTimeout(function load() { - AFRAME.ANode.prototype.load.call(self); - }); - }, - function handleOnProgress(xhr) { - self.emit("progress", { - loadedBytes: xhr.loaded, - totalBytes: xhr.total, - xhr: xhr - }); - }, - function handleOnError(xhr) { - self.emit("error", { xhr: xhr }); - } - ); - } - } - }) -}); diff --git a/src/hub.js b/src/hub.js index 81bab1168863396dd45b98c274a54403d09197d1..ed45825ea1de7378b6d6a44152d287ff8f7ba0c4 100644 --- a/src/hub.js +++ b/src/hub.js @@ -66,8 +66,6 @@ if (qs.quality) { window.APP.quality = isMobile ? "low" : "high"; } -import "./elements/a-progressive-asset"; - import "aframe-physics-system"; import "aframe-physics-extras"; import "super-hands"; diff --git a/webpack.config.js b/webpack.config.js index 44b833cedd8bd6882cb629bec366d44014003de3..56e643a7260f3d8214b116ad83f0aad876c3f4a1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -118,14 +118,7 @@ const config = { loader: "html-loader", options: { // <a-asset-item>'s src property is overwritten with the correct transformed asset url. - attrs: [ - "img:src", - "a-asset-item:src", - "a-progressive-asset:src", - "a-progressive-asset:high-src", - "a-progressive-asset:low-src", - "audio:src" - ], + attrs: ["img:src", "a-asset-item:src", "audio:src"], // You can get transformed asset urls in an html template using ${require("pathToFile.ext")} interpolate: "require" }