Skip to content
Snippets Groups Projects
Commit 9b3f40a4 authored by netpro2k's avatar netpro2k
Browse files

allow audio urls to load as video

parent 1b488167
No related branches found
No related tags found
No related merge requests found
...@@ -211,7 +211,7 @@ AFRAME.registerComponent("image-plus", { ...@@ -211,7 +211,7 @@ AFRAME.registerComponent("image-plus", {
texture = await this.loadGIF(url); texture = await this.loadGIF(url);
} else if (contentType.startsWith("image/")) { } else if (contentType.startsWith("image/")) {
texture = await this.loadImage(url); texture = await this.loadImage(url);
} else if (contentType.startsWith("video")) { } else if (contentType.startsWith("video") || contentType.startsWith("audio/")) {
texture = await this.loadVideo(url); texture = await this.loadVideo(url);
} else { } else {
throw new Error(`Unknown content type: ${contentType}`); throw new Error(`Unknown content type: ${contentType}`);
......
...@@ -58,7 +58,7 @@ AFRAME.registerComponent("media-loader", { ...@@ -58,7 +58,7 @@ AFRAME.registerComponent("media-loader", {
console.log("resolved", url, raw, origin, meta); console.log("resolved", url, raw, origin, meta);
const contentType = (meta && meta.expected_content_type) || (await fetchContentType(raw)); const contentType = (meta && meta.expected_content_type) || (await fetchContentType(raw));
if (contentType.startsWith("image/") || contentType.startsWith("video/")) { if (contentType.startsWith("image/") || contentType.startsWith("video/") || contentType.startsWith("audio/")) {
this.el.addEventListener( this.el.addEventListener(
"image-loaded", "image-loaded",
() => { () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment