chromium-for-stadia icon indicating copy to clipboard operation
chromium-for-stadia copied to clipboard

Issue about gvr-android-sdk

Open PhanSon95 opened this issue 5 years ago • 5 comments

@sigmaxipi First, I'm so sorry when post issue incorrect repository. Because repository gvr-android-sdk has been archived so I can't submit new issue or give you a question. I have a problem when play video 360:

  • When I play video 360 on with your sample, on first open starting angle of video correct ( center on frame 360 video ) , but in 2nd, 3nd... when I open video, the angle of video is different at each time open. I don't know why. I hope you can help me Again, I'm so sorry because post issue at here

PhanSon95 avatar Jan 14 '20 03:01 PhanSon95

You can try adding logs to https://github.com/googlevr/gvr-android-sdk/blob/master/samples/sdk-video360/src/main/java/com/google/vr/sdk/samples/video360/MonoscopicView.java#L132 and see what the Android sensor is outputing each time

sigmaxipi avatar Jan 15 '20 05:01 sigmaxipi

@sigmaxipi thank you because response to my issue.

public void onSensorChanged(SensorEvent event) {
            SensorManager.getRotationMatrixFromVector(phoneInWorldSpaceMatrix, event.values);

            // Extract the phone's roll and pass it on to touchTracker & renderer. Remapping is required
            // since we need the calculated roll of the phone to be independent of the phone's pitch &
            // yaw. Any operation that decomposes rotation to Euler angles needs to be performed
            // carefully.
            SensorManager.remapCoordinateSystem(
                    phoneInWorldSpaceMatrix,
                    SensorManager.AXIS_X, SensorManager.AXIS_MINUS_Z,
                    remappedPhoneMatrix);
            SensorManager.getOrientation(remappedPhoneMatrix, anglesRadians);
            float roll = anglesRadians[2];
            touchTracker.setRoll((float) (roll - Math.toRadians(displayRotationDegrees)));

            Log.d("MonoscopicView", "roll :[" + roll + "]");
            // Rotate from Android coordinates to OpenGL coordinates. Android's coordinate system
            // assumes Y points North and Z points to the sky. OpenGL has Y pointing up and Z pointing
            // toward the user.
            Matrix.rotateM(phoneInWorldSpaceMatrix, 0, 90, 1, 0, 0);
            renderer.setDeviceOrientation(phoneInWorldSpaceMatrix, roll);
        }

I've added log about roll value which was saved here Password: gvr

PhanSon95 avatar Jan 16 '20 02:01 PhanSon95

@sigmaxipi I've realized this bug will appear when:

  • First: open video 360, hold device front and angle is 0 degree
  • Second: move device from 0 to the left 90 degree, then exit player **** Open video again on front, but now angle of video at point when rotate -> left 90

It's mean : video's angle when start will be last angle before you exit video

PhanSon95 avatar Jan 16 '20 06:01 PhanSon95

You can try using the code in https://github.com/googlevr/gvr-android-sdk/issues/574 and seeing if that helps.

sigmaxipi avatar Jan 16 '20 17:01 sigmaxipi

@sigmaxipi Thank you for your response. I've applied your solution at here 1 month ago. It's worked with case when I change device's orientation from portrait -> landscape But my case is angle when start video. When I put my video 360 on your sample sdk-video360 and play, so error still appear.

PhanSon95 avatar Jan 17 '20 02:01 PhanSon95