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

Minimizing Video Bug #1145

Closed
2 of 3 tasks
breeze-bot opened this issue Jul 13, 2024 · 4 comments
Closed
2 of 3 tasks

Minimizing Video Bug #1145

breeze-bot opened this issue Jul 13, 2024 · 4 comments
Labels
Bug Something isn't working UI/UX

Comments

@breeze-bot
Copy link

What happened?

Device: Poco F5 (Android 14)

Enlarging a video when it is minimized causes the video to persist it's minimized size state.

Screenshot_20240713-162051_Grayjay

Slightly swiping the video down, or entering fullscreen and exiting, or pausing fixes the problem.

Grayjay Version

249

What plugins are you seeing the problem on?

All, Youtube, Twitch

Plugin Version

Youtube: 185, Twitch: 18

When do you experience the issue?

  • While logged in
  • While logged out
  • N/A

Relevant log output

No response

@michael-oberpriller
Copy link

From my testing, I found that explicitly setting the playerview's height in the fitHeight and fitFill functions within FutoVideoPlayer.kt seems to fix this problem.

    fun fitHeight(videoSize : VideoSize? = null){
        Logger.i(TAG, "Video Fit Height");

        var h = videoSize?.height ?: lastVideoSource?.height ?: exoPlayer?.player?.videoSize?.height ?: 0;
        var w = videoSize?.width ?: lastVideoSource?.width ?: exoPlayer?.player?.videoSize?.width ?: 0;

        if(h == 0 && w == 0) {
            Logger.i(TAG, "UNKNOWN VIDEO FIT: (videoSize: ${videoSize != null}, player.videoSize: ${exoPlayer?.player?.videoSize != null})");
            w = 1280;
            h = 720;
        }

        if(_lastSourceFit == null){
            val metrics = StateApp.instance.displayMetrics ?: resources.displayMetrics;

            val viewWidth = Math.min(metrics.widthPixels, metrics.heightPixels); //TODO: Get parent width. was this.width
            val deviceHeight = Math.max(metrics.widthPixels, metrics.heightPixels);
            val maxHeight = deviceHeight * 0.4;

            val determinedHeight = if(w > h)
                ((h * (viewWidth.toDouble() / w)).toInt())
            else
                ((h * (viewWidth.toDouble() / w)).toInt());
            _lastSourceFit = determinedHeight;
            _lastSourceFit = Math.max(_lastSourceFit!!, 250);
            _lastSourceFit = Math.min(_lastSourceFit!!, maxHeight.toInt());
            if((_lastSourceFit ?: 0) < 300 || (_lastSourceFit ?: 0) > viewWidth) {
                Log.d(TAG, "WEIRD HEIGHT DETECTED: ${_lastSourceFit}, Width: ${w}, Height: ${h}, VWidth: ${viewWidth}");
            }
            if(_lastSourceFit != determinedHeight)
                _videoView.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT;
            else
                _videoView.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM;
        }

        val layoutParams = _videoView.layoutParams as ConstraintLayout.LayoutParams;
        layoutParams.setMargins(0, 0, 0, _originalBottomMargin);
        layoutParams.height = _lastSourceFit!!;
        _videoView.layoutParams = layoutParams;

        val marginBottom = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 7f, resources.displayMetrics).toInt();
        val rootParams = LayoutParams(LayoutParams.MATCH_PARENT, _lastSourceFit!! + marginBottom)
        rootParams.bottomMargin = marginBottom;
        _root.layoutParams = rootParams
        isFitMode = true;
    }
    fun fillHeight(){
        Logger.i(TAG, "Video Fill Height");
        val layoutParams = _videoView.layoutParams as ConstraintLayout.LayoutParams;
        _originalBottomMargin = if(layoutParams.bottomMargin > 0) layoutParams.bottomMargin else _originalBottomMargin;
        layoutParams.setMargins(0);
        layoutParams.height = LayoutParams.MATCH_PARENT;
        _videoView.layoutParams = layoutParams;
        _videoView.invalidate();

        val rootParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        _root.layoutParams = rootParams;
        _root.invalidate();
        isFitMode = false;
    }

@cpfotiadis
Copy link

I have the same problem on a Pixel 6a with GrapheneOS and I can confirm that the problem has been around for quite some time. It doesn't matter the plugin, it gives me the exact same problem, whether it's with the YouTube plugin, Rumble, Odysee or BitChute. The problem can be reproduced very easily, as long as we minimize a video while it is playing and then restore it. If we do this several times while the video is playing, the problem will appear for sure.

Slightly swiping the video down, or entering fullscreen and exiting, or pausing fixes the problem.

Also, what the user @breeze-bot wrote about swiping, fullscreen, etc., applies to my case as well.

GrayJay Version:

262

What plugins are you seeing the problem on?

YouTube, Rumble, Odysee, BitChute

Plugin Version

YouTube: 201
Rumble: 45
Odysee: 38
BitChute: 4

Example:

Screenshot_20240907-084326

@michael-oberpriller
Copy link

This issues seems to be fixed for me on the latest version of grayjay.

@Zvonimir-FUTO
Copy link
Collaborator

Zvonimir-FUTO commented Nov 19, 2024

Didn't experience the bug since the 264 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working UI/UX
Projects
None yet
Development

No branches or pull requests

5 participants