Skip to content

improve: Unlocalised Video Titles#5793

Open
bluegate-studio wants to merge 2 commits into
yuliskov:masterfrom
bluegate-studio:improve/unlocalised-titles
Open

improve: Unlocalised Video Titles#5793
bluegate-studio wants to merge 2 commits into
yuliskov:masterfrom
bluegate-studio:improve/unlocalised-titles

Conversation

@bluegate-studio

Copy link
Copy Markdown

Problem

The "Unlocalised video titles" feature fires a separate HTTP request (to YouTube's oEmbed endpoint) for every video card on screen. A typical Home screen with ~50 videos triggers ~50 individual network requests — on every visit, with no caching across sessions.

Additionally, the player title bar was not covered by the feature. Videos entering the player via deep links, casting, or remote control would display YouTube's auto-translated metadataTitle instead of the original.

Changes

1. Persistent title cache (UnlocalizedTitleData)

  • New class: UnlocalizedTitleData — SharedPreferences-backed FIFO cache (5,000 entries) mapping videoId → original title.
  • Original titles are immutable, so the cache needs no TTL or invalidation.
  • Uses established codebase patterns: Helpers.mergeMap/parseMap for serialisation, Utils.postDelayed (10s debounce) for disk writes.
  • After the first browsing session, most titles are served from cache with zero network cost.

2. Cache-first processor (UnlocalizedTitleProcessor)

  • On each VideoGroup, the processor now checks the cache before queueing an oEmbed request.
  • Cache hits are applied synchronously — no network call, no async delay.
  • Cache misses are fetched and cached on arrival for future sessions.

3. Player title coverage (SuggestionsController)

  • After video.sync(metadata) sets the (potentially translated) metadataTitle, resolveUnlocalizedTitle() now runs:
    • If deArrowTitle is already set (from browse card) → no-op.
    • Cache hit → applied synchronously before setVideo.
    • Cache miss → single async oEmbed fetch; player title refreshes on arrival.
  • Covers deep links, casting, and remote control scenarios.

Files Changed

File Change
UnlocalizedTitleData.java New — persistent FIFO cache
UnlocalizedTitleProcessor.java Modified — cache-first lookup
SuggestionsController.java Modified — player title resolution

@bluegate-studio bluegate-studio changed the title Improve Unlocalised Video Titles improve: Unlocalised Video Titles May 19, 2026
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.

1 participant