futo-org / grayjay-android

Read-only mirror of Grayjay repo for issue tracking
https://gitlab.futo.org/videostreaming/grayjay
Other
763 stars 48 forks source link

[Bug Report] Rotating deadzone not working #67

Closed Z3R0-CDS closed 1 month ago

Z3R0-CDS commented 1 year ago

On my Phone (S23 U) even slight angles can make the app go nuts, that sucks not only for viewing/watching vids but also for using the app. In some situations I cant even click , I need reposition my hand a bit because of the phone size, and bam the app rotates and or freaks out. It should only react to steeper angles I think.

Cameron356 commented 1 year ago

This actually already exists in the settings where you can change the deadzone for rotation

Z3R0-CDS commented 1 year ago

Yeah I tried that but it does not seem to help at all

Dillpickleschmidt commented 1 year ago

+1 on this. For most people, knowing that there is a setting for this is definitely not obvious so it should be less sensitive by default. It flips around constantly just walking with my phone in my hands. Also, for me it doesn't seem like the sensitivity deadzone adjustment is doing much either. It I put my phone at a certain angle (the angle in which I hold it when falling asleep), it still constantly flips back and forth at that point. I've set deadzone at 20.

mattvisa commented 1 year ago

I tried all the options to reduce screen rotation sensitivity and nothing made it less sensitive. Same feedback is OP

arczimboldo commented 1 year ago

Yes please it's so sensitive even with the deadzone set to 20 to the point that i consider disabling auto-rotate altogether

McIrco95 commented 1 year ago

I have auto rotate off but when watching videos in fullscreen on my bicycle it rotates like crazy. Please add a limit to how often it can rotate. No user ever wants to rotate the screen 100 times per minute.

xephos1one commented 1 year ago

I don't think this is an issue with deadzones/angles. When you hold the phone perfectly horizontal while watching in landscape mode and you shake the phone left and right it constantly switches between portrait and landscape mode - all while holding the phone perfectly horizontal.

JustCryen commented 1 year ago

I don't think this is an issue with deadzones/angles. When you hold the phone perfectly horizontal while watching in landscape mode and you shake the phone left and right it constantly switches between portrait and landscape mode - all while holding the phone perfectly horizontal.

Exactly this! It seems like GrayJay is not using only a gyroscope (angular momentum) for determining rotation but at the same time, it's using an accelerometer (linear acceleration on 3 axis). This might be an overkill, and a reason why the deadzone setting is not working. I've heard that using a magnetometer in conjunction with other methods is also sometimes used to determine rotation, but I'm not quite sure if it'll help for this type of rotation we're thinking about (vertical / horizontal screen orientation)

I'm by no means knowledgeable enough to implement this in an app so there's probably quite a bit more to it. Maybe it's not about which sensors are used but how. The raw sensor data must be filtered if it isn't already, that's for sure.

EricsenSemedo commented 12 months ago

I don't think this is an issue with deadzones/angles. When you hold the phone perfectly horizontal while watching in landscape mode and you shake the phone left and right it constantly switches between portrait and landscape mode - all while holding the phone perfectly horizontal.

Exactly this! It seems like GrayJay is not using only a gyroscope (angular momentum) for determining rotation but at the same time, it's using an accelerometer (linear acceleration on 3 axis). This might be an overkill, and a reason why the deadzone setting is not working. I've heard that using a magnetometer in conjunction with other methods is also sometimes used to determine rotation, but I'm not quite sure if it'll help for this type of rotation we're thinking about (vertical / horizontal screen orientation)

I'm by no means knowledgeable enough to implement this in an app so there's probably quite a bit more to it. Maybe it's not about which sensors are used but how. The raw sensor data must be filtered if it isn't already, that's for sure.

I was about to comment on this but to reiterate, it seems like it's using the accelerometer to get the orientation. Any movement left or right would trigger a rotation of the screen. Please fix.

JustCryen commented 12 months ago

It's actually more of a bug report than a feature request (Unlike the title suggests)

Z3R0-CDS commented 12 months ago

Maybe now it fits better

Darkvramp commented 11 months ago

So I am watching a video in portrait mode, in a chair cross legged, resting on my lap, and 2 things will happen,

  1. If I rock back and forth in the chair, it will flip around and around the screen to oriented with whatever side.
  2. If watch a video in landscape and hit the back button, it gets stuck on landscape unable to go back to portrait.
KannaHayabusa commented 11 months ago

Issue still not fixed. December 12th.

neverson42 commented 10 months ago

Problem still occurs as of 12/20.

I listen to videos while commuting to and from work. Phone is usually laying in the passenger seat. The entire drive - even on flat and relatively smooth road - its just flipping between landscape and portrait the whole time. As others have mentioned, adjusting the dead zone doesnt seem to change anything.

Doubs115 commented 10 months ago

So glad I'm not the only one who found this obnoxious. Maybe it's not the same for others but up untill vary recently this has been an issue for me.

I have also found that almost perfectly still if tilted the wrong way it will compleatly freak out and flip in every dirrection in a second.

I also think there should be a manual rotate option like android has. Or just allow the option to push the OS's manual rotate if in portrait mode. I know there exsists the lock rotation button but it's exstra steps compared to manual rotate IMO.

JustCryen commented 10 months ago

Additionally, when using "Bypass Rotation Prevention" when exiting the video view, the screen gets forcefully rotated to portrait view.

I'm gonna use the Bypass Rotation Prevention option because it just feels better to use the app that allows searching for another video without having to pick up and rotate the phone every single time.

Sometimes I just want to use the app only in landscape.

MrCamel999 commented 10 months ago

This problem has seemingly been resolved for me!

xephos1one commented 10 months ago

Negative, the issue with the constant switching between pandscape and portrait mode (when moving the phone left and right while it's perfectly horizontal) persists even in version 225.

MrCamel999 commented 10 months ago

I'm on version 227, try updating maybe?

xephos1one commented 10 months ago

@MrCamel999 Version 225 didn't even exist when you wrote that earlier comment...

MrCamel999 commented 10 months ago

Ah, gotcha. Idk then lol, I just know it's currently working for me. I also had a weird issue where I had changed the default comment section and it wasn't working, but it did work sometime later in an update. Maybe it forgot to apply the settings in some way earlier and it was fixed? That would explain why I at least feel a difference if the deadzone thing now works? I will admit it isn't as good as something like NewPipe in terms of sensitivity to turning, but it's definitely better than before for me.

KannaHayabusa commented 9 months ago

Not fixed in 2024. This is one of the major issues keeping me from using the app full-time. It's weird how Grayjay is the only app that I've encountered this issue with.

MKBontwikkeling commented 7 months ago

Why not add a delay (like 2 seconds) before a rotation. That way a lot of unwanted motion is filtered out and it's probably easier to implement than other hardware solutions.

xephos1one commented 7 months ago

Why not add a delay (like 2 seconds) before a rotation. That way a lot of unwanted motion is filtered out and it's probably easier to implement than other hardware solutions.

Because you don't want to wait 2 seconds for the screen to rotate after putting the phone to landscape.

Z3R0-CDS commented 7 months ago

It's really astounding that the issue still exists...

samir-nmx commented 7 months ago

May I ask why the app is even using sensor data to set orientation? Android provides device orientation, and pretty much every other app uses that method and works much better.

(Also, please re-enable 180° rotation or at least make it optional in settings)

xephos1one commented 7 months ago

Sadly I'm not a developer so I can't test it but I asked ChatGPT and it recommends the following:


"Implementing a filtering algorithm in the OrientationManager.kt to reduce noise in accelerometer data can help improve the stability of orientation detection. One commonly used filtering technique is the low-pass filter. Here's how you can incorporate a simple low-pass filter into your OrientationManager.kt:

class OrientationManager(context: Context) : OrientationEventListener(context) {

    // Constants for low-pass filter
    private val ALPHA = 0.1f
    private var lastOrientationAngle = 0

    override fun onOrientationChanged(orientationAngle: Int) {
        if (orientationAngle == -1) return

        // Apply low-pass filter
        val filteredOrientationAngle = lowPassFilter(orientationAngle.toFloat(), lastOrientationAngle.toFloat())
        lastOrientationAngle = filteredOrientationAngle.toInt()

        // Your existing code
        // Update orientation based on filtered orientation angle
        // Emit orientation change event
    }

    // Low-pass filter function
    private fun lowPassFilter(input: Float, output: Float): Float {
        return output + ALPHA * (input - output)
    }
}

In this implementation, the onOrientationChanged method applies a low-pass filter to the incoming orientation angle data before processing it further. The lowPassFilter function takes the current orientation angle (input) and the previously filtered orientation angle (output), applies the low-pass filter formula, and returns the filtered orientation angle.

Adjust the ALPHA constant to control the strength of the filter. A smaller ALPHA value will result in a smoother output but might introduce more latency, while a larger ALPHA value will provide a faster response but might be more sensitive to noise.

By applying this simple low-pass filter, you can smooth out noise and fluctuations in the accelerometer data, leading to more stable orientation detection in your app. Feel free to adjust the filter parameters and experiment with different filtering techniques to achieve the desired level of accuracy and responsiveness."


Maybe such a filter can help removing the sudden changes between landscape and portrait mode? Can someone with programming experience have a look at the current OrientationManager.kt and the (possible) improvement ChatGPT proposes?

JustCryen commented 6 months ago

Hey, there's another maybe related issue I just found out today. One option above the dead zone, so "Auto-rotate" also doesn't work properly.
I have it set to "Same as System" and it turns out that after I disabled auto rotation in my OS, Grayjay still rotates the screen.

I do have "bypass rotation prevention" option (allows rotation on the video list / main view of the app) and "fullscreen portrait" option enabled.

The only place where the rotation is actually following the settings is the comments / video information page.

dansushi commented 6 months ago

Very obnoxious issue, happening for me too and sad to see it isn't being resolved. Seems like an easy fix.

KannaHayabusa commented 4 months ago

It is currently June 29th and this issue has yet to be fixed.

Cameron356 commented 4 months ago

does anyone have any new idea on where the root of this bug is? @JustCryen did you find that both of the issues are related or is that still an assumption?

JustCryen commented 4 months ago

It's just an assumption. I haven't yet looked in the source code for grayjay.

But still, having autorotation disabled systemwide and having grayjay still rotate the screen automatically seems related.

I just tested it now and it still happens.

samir-nmx commented 4 months ago

does anyone have any new idea on where the root of this bug is?

I'm not competent enough to go through the code, but based on some experimentation I strongly suspect that the root cause is the app doesn't use device orientation data from the system but rather uses sensor data to calculate orientation. And the algorithm they use seems a bit too aggressive.

Why do I believe this?

My phone uses a combination of sensor data and eye tracking to set system-wide orientation. Meaning if I lie down on my side, or turn my head sideways, all other apps will follow, using my head's orientation as a base-line. GrayJay is the only app that completely disregards this and only adapts to the phone's true orientation.

that404nerd commented 4 months ago

Seems like turning on auto rotation option to go into portrait mode and then into landscape mode makes the app stay in landscape mode. After like 10 seconds it switches back to portrait mode and when I enter the search bar the keyboard is cut in half. The keyboard becomes normal after switching from another app. I am using a Lenovo Tab. I hope this issue is fixed as soon as possible.

Z3R0-CDS commented 3 months ago

Can't believe that thus bug still made 0 progress. Wasn't grayjay supposed to be better than yt? This bug really keeps me away from using it tbh. When I lie in bed (wich is where I view most of the content) the optimal position is exactly where the bug appears. Either I will not use the app until it is fixed or in some unknown future I have to look into the src myself. This issue is open for soooo long now.

that404nerd commented 3 months ago

Can't believe that thus bug still made 0 progress. Wasn't grayjay supposed to be better than yt? This bug really keeps me away from using it tbh. When I lie in bed (wich is where I view most of the content) the optimal position is exactly where the bug appears. Either I will not use the app until it is fixed or in some unknown future I have to look into the src myself. This issue is open for soooo long now.

I hope someone or some moderator looks into all of these issues. Really bugs me out since this app has a lot of potential to be the next best open source application for YouTube, odysee and the sources they support. I am forced to use a rotation control application and its really bad since the UI only works perfectly on mobile devices.

Gundog256 commented 3 months ago

Bump. Disabling auto-rotate doesn't work. Setting it to "same as system" doesn't work (auto-rotate is disabled in my system settings), and adjusting the deadzones helps slightly, but I really want to just turn it off. Please address this issue, it's the only thing still keeping me on Revanced despite supporting this project. GrayJay is way more convenient in terms of updates (don't have to manually patch a new version every time the older one stops working), but this issue is just an everyday usability nuisance. Poco X3 pro, Android 13, MIUI global 14.0.2.0 (dunno if this is helpful, hopefully it is). GrayJay version 253, downloaded directly from the site.

samir-nmx commented 3 months ago

Bump. Disabling auto-rotate doesn't work. Setting it to "same as system" doesn't work (auto-rotate is disabled in my system settings), and adjusting the deadzones helps slightly, but I really want to just turn it off. Please address this issue, it's the only thing still keeping me on Revanced despite supporting this project. GrayJay is way more convenient in terms of updates (don't have to manually patch a new version every time the older one stops working), but this issue is just an everyday usability nuisance. Poco X3 pro, Android 13, MIUI global 14.0.2.0 (dunno if this is helpful, hopefully it is). GrayJay version 253, downloaded directly from the site.

On MIUI, you should be able to go into App Info > Permissions > Other Permissions and turn off "Access device motion and orientation". That's the workaround I use for now.

usertoroot commented 2 months ago

Next version will just use the standard Android rotation it should be a more stable experience on a wider array of devices.

that404nerd commented 2 months ago

Next version will just use the standard Android rotation it should be a more stable experience on a wider array of devices.

Will this fix the inconsistent layout in landscape mode? When will be the next release? Thanks for responding. Hope everything goes well.

usertoroot commented 2 months ago

@that404nerd bit offtopic for this specific issue but we plan to include proper landscape support in the release after the next one (so not this release, but the next). The upcoming release is planned for next week.

that404nerd commented 2 months ago

@that404nerd bit offtopic for this specific issue but we plan to include proper landscape support in the release after the next one (so not this release, but the next). The upcoming release is planned for next week.

Hey! Thanks for responding, looking forward for the next release.

Giesa-lab commented 2 months ago

Actually, @usertoroot and @that404nerd ... in the new release 259 it didn't fix the rotation issue at all, and menus are all now Stuck in Portrait view, except in Full screen Video view which does now still switch to Landscape view... WHATEVER a user chooses in these settings 🙄☹ī¸

that404nerd commented 2 months ago

Actually, @usertoroot and @that404nerd ... in the new release 259 it didn't fix the rotation issue at all, and menus are all now Stuck in Portrait view, except in Full screen Video view which does now still switch to Landscape view... WHATEVER a user chooses in these settings 🙄☹ī¸

You mean the landscape support? It's meant to be in the next release. I think @usertoroot mentioned this.

JustCryen commented 2 months ago

Rotation seems to be fixed for me. I think the deadzone setting has been removed, which makes sense.

The only thing related to the rotation that seems to be missing right now is rotation on the home feed / video list screen.

Overall it's way better now, Thank you!

that404nerd commented 2 months ago

Rotation seems to be fixed for me. I think the deadzone setting has been removed, which makes sense.

The only thing related to the rotation that seems to be missing right now is rotation on the home feed / video list screen.

Overall it's way better now, Thank you!

Looks like the app is not going nuts when trying to rotate stuff. Only thing that bothers me is the landscape ui since some buttons don't work properly and other issues. But I am waiting for the next release. I am sure they will fix those stuff. Other than that it's an amazing app

Giesa-lab commented 2 months ago

@that404nerd @JustCryen @usertoroot

With V262 the rotation issue is FIXED, so far as "Same As System" option is concerned, and now every menu does follow system settings on Android 9+ , and will show as Landscape, with the exception of the settings menu, which still displays only in Portrait mode, no matter which setting is chosen. Maybe this is enough ? 😎👍

that404nerd commented 2 months ago

@that404nerd @JustCryen @usertoroot

With V262 the rotation issue is FIXED, so far as "Same As System" option is concerned, and now every menu does follow system settings on Android 9+ , and will show as Landscape, with the exception of the settings menu, which still displays only in Portrait mode, no matter which setting is chosen. Maybe this is enough ? 😎👍

The landscape UI needs to tweaked a little bit since it doesn't look that good IMO. Hope they fix that issue but other than that it works just fine. Thanks for the work!

JustCryen commented 2 months ago

With V262 the rotation issue is FIXED, so far as "Same As System" option is concerned, and now every menu does follow system settings on Android 9+ , and will show as Landscape, with the exception of the settings menu, which still displays only in Portrait mode, no matter which setting is chosen. Maybe this is enough ? 😎👍

When I wrote my previous message I was using v259, now on v262 the rotation in other places like a home feed is working great!

that404nerd commented 1 month ago

With V262 the rotation issue is FIXED, so far as "Same As System" option is concerned, and now every menu does follow system settings on Android 9+ , and will show as Landscape, with the exception of the settings menu, which still displays only in Portrait mode, no matter which setting is chosen. Maybe this is enough ? 😎👍

When I wrote my previous message I was using v259, now on v262 the rotation in other places like a home feed is working great!

Yes! Other than the settings page,the rotation works amazingly well. If they improve the landscape UI and make the settings page work in landscape mode most of the issues are pretty much solved. Also why is the bypass rotation prevention not enabled by default? Enabling that option fixed my issue (v264). Thanks!