Skip to content

Calling createVideoTexture with cross origin video url cause CORS error #4634

@navidadelpour

Description

@navidadelpour

Description

How To Reproduce

  1. Run this example on localhost or glitch.com.
  2. Switch to video mode.
  3. The below error is logged in the console.
THREE.WebGLState: DOMException: Failed to execute 'texImage2D' on 'WebGL2RenderingContext': The video element contains cross-origin data, and may not be loaded.

Live Demo

https://glitch.com/edit/#!/stellar-abstracted-verdict

Solution

As I searched about this issue, I come across this issue that addresses the same problem which solved with this. And I submitted a PR that fixes this issue by letting us call the createVideoTexture like this:

createVideoTexture(url, {crossOrigin: "anonymous"})

The detailed Implementation will be explained in the PR. I would be glad to know if there are anything else needed for this feature. or it can be solved via another solution.

Version

  • model-viewer: v3.3.0

Browser Affected

I only checked the issue on the chrome. I guess the issue exists in all browsers.

  • Chrome, version: 120.0.6099.109
  • Edge
  • Firefox
  • IE
  • Safari

OS

  • Android
  • iOS
  • Linux
  • MacOS
  • Windows

AR

  • WebXR
  • SceneViewer
  • QuickLook

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions