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

Fix quality selection and latency stats using an asyncQuerySelector #340

Merged
merged 4 commits into from
Apr 21, 2024

Conversation

Shingyx
Copy link
Contributor

@Shingyx Shingyx commented Apr 21, 2024

I was looking into why stream qualities weren't displaying for me on the custom overlay, and found it was occurring because after clicking the ⚙️ settings button on the player, the menu doesn't appear until a split second later.

To fix this, I've updated the stream quality methods to use a new asyncQuerySelector instead of document.querySelector. I had to apply the same fix to the latency stats to ensure consistent stream quality behaviour, as they also interact with the settings menu.

This change to using async JS code means that awaiting for videoWebViewController.runJavaScript no longer guarantees that the previous task actually completed, which was causing issues with the current defaultToHighestQuality logic. I resolved this by updating this setting to call a new _setStreamQualityIndex(1) instead. This also has the benefit of not "flashing" the settings menu twice when using defaultToHighestQuality without the custom overlay.

Fixes #338 (and maybe #334?)

@tommyxchow tommyxchow self-assigned this Apr 21, 2024
@tommyxchow tommyxchow added the bug fix A fix for a bug label Apr 21, 2024
Copy link
Owner

@tommyxchow tommyxchow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Fantastic work and explanation, thank you so much!

The PR check is failing but we can ignore it, looks to be due to some new lint rules in the newer Flutter versions. I'll fix them after merging.

@tommyxchow tommyxchow merged commit feb2030 into tommyxchow:main Apr 21, 2024
1 check failed
@Shingyx Shingyx deleted the fix-quality-select branch April 22, 2024 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix A fix for a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't change stream quality
2 participants