Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change projection type #266

Open
Michal-Szczepaniak opened this issue Sep 3, 2022 · 6 comments
Open

Cannot change projection type #266

Michal-Szczepaniak opened this issue Sep 3, 2022 · 6 comments

Comments

@Michal-Szczepaniak
Copy link

Description

When I try to change projection using player.mediainfo.projection or player.vr({projection: '180'}); I get error

Steps to reproduce

npm i videojs-vr

<html>
<head>
<link href="node_modules/video.js/dist/video-js.css" rel="stylesheet">
<link href="node_modules/videojs-vr/dist/videojs-vr.css" rel="stylesheet">
</head>
<body>
    <video width="640" height="300" id="videojs-vr-player" class="video-js vjs-default-skin" controls playsinline>
        <source src="test.mp4" type="video/mp4">
    </video>
    <script src="node_modules/video.js/dist/video.js"></script>
    <script src="node_modules/videojs-vr/dist/videojs-vr.js"></script>
    <script>
        var player = videojs('videojs-vr-player');;
        player.vr({projection: '180'});
    </script>
</body>
</html>

Results

Expected

Working 180° player

Actual

Error

Error output

video.js:212 VIDEOJS: ERROR: TypeError: Cannot read properties of undefined (reading '0')
    at VR.changeProjection_ (videojs-vr.js:48939:42)
    at VR.init (videojs-vr.js:49298:11)
    at data.dispatcher (video.js:2323:33)
    at trigger (video.js:2459:27)
    at Player.trigger$1 [as trigger] (video.js:3400:14)
    at Player.<computed> [as handleTechLoadedmetadata_] (video.js:30002:19)
    at Player.<anonymous> (video.js:25705:67)
    at data.dispatcher (video.js:2323:33)

Additional Information

versions

videojs

1.10.1 and 1.10.0

browsers

chrome 104.0.5112.101

OSes

Linux openSUSE Tumbleweed

plugins

nope

@Michal-Szczepaniak
Copy link
Author

Michal-Szczepaniak commented Sep 3, 2022

On firefox I get

VIDEOJS: ERROR: TypeError: _geometry.faceVertexUvs is undefined

@Michal-Szczepaniak
Copy link
Author

I've tried 180_mono from examples and its also not working

@ruhowe
Copy link

ruhowe commented Mar 23, 2023

I also have this issue. 360 sphere works ok - toggling other settings do not. Is there something else to enable or disable? Does it not work with AUTO?

@OevreFlataeker
Copy link

OevreFlataeker commented Apr 1, 2023

Same issue here. Was stepping into the code and trying to understand what's going on. It almost appears to me as if the current version is not 100% compatible with the main video.js source?

I patched some tests and had it run to new BufferGeometry().fromGeometry(geometry); when I got another exception

// Left eye view
        geometry.scale(-1, 1, 1);
        // let uvs = geometry.faceVertexUvs[0]; // disabled
        if (projection == '180_MONO') {  // toggled !== -> ==
          for (let i = 0; i < uvs.length; i++) {
            for (let j = 0; j < 3; j++) {
              uvs[i][j].x *= 0.5;
            }
          }
        }
        this.movieGeometry = new BufferGeometry().fromGeometry(geometry); // <-- Exception here
        this.movieMaterial = new MeshBasicMaterial({
          map: this.videoTexture,
          overdraw: true
        });

video.js:206 VIDEOJS: ERROR: TypeError: (intermediate value).fromGeometry is not a function
at VR.changeProjection_ (videojs-vr.js:34184:51)
at VR.init (videojs-vr.js:34499:12)
at data.dispatcher (video.js:2132:33)
at trigger (video.js:2263:27)
at Player.trigger (video.js:3130:14)
at Player. [as handleTechLoadedmetadata_] (video.js:27003:19)
at Player. (video.js:23200:83)
at data.dispatcher (video.js:2132:33)

@OevreFlataeker
Copy link

@OevreFlataeker
Copy link

"Fixed" the above code with:

//let uvs = geometry.faceVertexUvs[0];
        let uvs = geometry.getAttribute("uv")
        if (projection !== '180_MONO') {
          for (let i = 0; i < uvs.length; i+=2) {
            //for (let j = 0; j < 3; j++) {
              //uvs[i][j].x *= 0.5;
                uvs[i] *= 0.5;
                
            //}
                
          }
           uvs.needsUpdate = true;
        }

Now the next exception is thrown when reaching "this.movieGeometry = new BufferGeometry().fromGeometry(geometry);"

"TypeError: (intermediate value).fromGeometry is not a function" - again deprectated it seems.

https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants