Skip to content

Fix Android TV quality switch overlay bug and respect default quality - #47

Open
xayron wants to merge 2 commits into
Spyou:mainfrom
xayron:fix/default-player-quality
Open

Fix Android TV quality switch overlay bug and respect default quality#47
xayron wants to merge 2 commits into
Spyou:mainfrom
xayron:fix/default-player-quality

Conversation

@xayron

@xayron xayron commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

What changed

This commit resolves two playback issues:

  1. Android TV Stuttering/Overlay Bug on Quality Switch: By default, PlayerView retains the last decoded frame on the SurfaceView when the player is stopped/reset. On Android TV's hardware overlay, this caused the new video source to render as a smaller overlay on top of the stale, stuttering frame from the previous source. Added track selection override resets loading a new source to prevent previous bitrate caps or audio track choices from bleeding into the new decoder pipeline.

  2. Global Default Quality (e.g., 720p) Ignored on Non-HLS Streams: Previously, the player ignored user preferences and hardcoded the choice to the absolute highest quality.

Checklist

  • flutter analyze is clean
  • flutter test passes
  • Native build still compiles, if I touched android/ or ios/
  • I've read and agree to the CLA
  • New dependency or third-party code? NOTICE.md updated in this PR
  • Used AI tooling? Disclosed per AI_POLICY.md

Screenshots

Before:

image image

After:
image

image

… for non-HLS streams

This commit resolves two playback issues:

1. Android TV Stuttering/Overlay Bug on Quality Switch: By default, PlayerView retains the last decoded frame on the SurfaceView when the player is stopped/reset. On Android TV's hardware overlay, this caused the new video source to render as a smaller overlay on top of the stale, stuttering frame from the previous source. Added track selection override resets loading a new source to prevent previous bitrate caps or audio track choices from bleeding into the new decoder pipeline.

2. Global Default Quality (e.g., 720p) Ignored on Non-HLS Streams: Previously, the player ignored user preferences and hardcoded the choice to the absolute highest quality.
@xayron xayron changed the title Fix Android TV quality switch overlay bug and respect default quality… Fix Android TV quality switch overlay bug and respect default quality Aug 22, 2026
@NeighborhoodNerd
NeighborhoodNerd self-requested a review August 23, 2026 15:52
Comment thread android/app/src/main/kotlin/com/spyou/watch_app/ExoPlayerView.kt Outdated
@NeighborhoodNerd

Copy link
Copy Markdown
Collaborator

@xayron bump

@xayron

xayron commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Hi. Sorry for the delayed response. I will look into your suggestions and try incoprating them. If nothing breaks, will push again with the changes you suggested.

@xayron

xayron commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

@NeighborhoodNerd made the changes as per your suggestion

@NeighborhoodNerd

Copy link
Copy Markdown
Collaborator

Thanks for the follow-up and for narrowing the track override reset to video-only — that addresses the audio-reset concern.

This branch can't merge cleanly against current main anymore (all 6 files conflict). More importantly, the Dart side overlaps work that landed in 9421b5b: pickDefault now takes preferQuality with resolutionPx + nearest-match logic and tests in test/playback/source_selection_test.dart. Please drop the source_selection.dart changes from this PR rather than reintroducing a parallel pref/qualityRank implementation.

What we'd still like from this PR:

  1. Keep the Kotlin Android TV fixessetKeepContentOnPlayerReset(false) and the stop/clear/clear video overrides before loading a new source in ExoPlayerView.kt and TvPlayerActivity.kt.
  2. Wire default quality on the remaining call sites using the existing API, e.g. pickDefault(..., preferQuality: sl<PlaybackPrefs>().defaultQuality) in:
    • player_screen.dart
    • tv_exo_player_screen.dart (both call sites)
    • tv_native_player.dart

Please rebase onto latest main, resolve conflicts keeping our preferQuality implementation, and run flutter analyze + flutter test before pushing (checklist items still open).

Note: the ExoPlayerView.kt changes also affect the phone DRM platform view, not just TV — a quick sanity check there after rebase would be appreciated.

Happy to re-review once rebased.

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

Successfully merging this pull request may close these issues.

2 participants