Skip to content

fix(player): load auto-translated captions on Android 14 and newer - #2066

Merged
A-EDev merged 6 commits into
mainfrom
fix/translated-caption-requests
Nov 14, 2026
Merged

A-EDev merged 6 commits into
mainfrom
fix/translated-caption-requests

Conversation

@A-EDev

@A-EDev A-EDev commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Captions are fetched over Android's own Cronet (Media3 HttpEngineDataSource on android.net.http.HttpEngine) on Android 14 and newer. YouTube answers an auto-translated caption (&tlang=) over it and refuses the same URL over OkHttp with 429.
  • Caption requests send only a Chrome mobile user agent and Accept, without the browser Origin, Referer and Sec-Fetch-* headers, like NewTube.
  • A translation is made from the video's speech (ASR) track in VTT, skipping dubbed and timing-optimized tracks, like YouTube's apps.
  • Each translated caption fetch is logged as loaded or refused, with its source track.

On a phone (same network, same video, interleaved runs), OkHttp got 429 on every translated request, while HttpEngineDataSource loaded the Arabic translation in 3 of 3 rounds, with the captions on screen.

Related issue

Part of #1369 and #1434

Change type

  • Bug fix
  • Feature
  • Refactor or maintenance
  • Build, packaging, or CI
  • Documentation

Validation

  • ./gradlew :app:assembleGithubDebug
  • ./gradlew :app:testGithubDebugUnitTest --tests '*GoogleVideoRequestPolicyTest' --tests '*CaptionTrackResolverTest' --tests '*SubtitleLoadDiagnosticsTest' (22 tests, 0 failed)
  • I ran any additional flavor-specific build or test tasks affected by this change. (spotlessCheck, :app:compileFossDebugKotlin, :app:lintGithubDebug)
  • I manually tested the affected behavior on an Android device or emulator. Arabic (translated) on an English video: loaded over the platform engine (Cronet version: 150.0.7871.41, HttpEngineDataSource) after two 429 retries, fmt=vtt source=asr bytes=221001, Arabic captions on screen.

Test device and Android version: Xiaomi phone, Android 16 (API 36)

Screenshots or recordings

Risk and compatibility

  • No new dependency: HttpEngineDataSource ships in media3-datasource 1.11.0 and the engine is part of Android 14.

  • The engine is built once, on the first caption, and kept for the process.

  • With the app proxy on, captions stay on OkHttp, since HttpEngine takes no proxy. Android 13 and older also stay on OkHttp.

  • The change does not introduce secrets, private data, or unexpected telemetry.

  • New user-facing text uses Android string resources.

  • Dependency and lockfile changes are intentional and limited to this PR.

  • Room schema changes include the required version bump and migration, or this PR does not change the Room schema.

  • Breaking changes and upgrade steps are clearly documented.

Copilot AI balanced review requested due to automatic review settings November 14, 2026 09:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions github-actions Bot added documentation Improvements or additions to documentation player Video and audio playback labels Nov 14, 2026
@A-EDev
A-EDev merged commit 2d549a7 into main Nov 14, 2026
9 checks passed
@A-EDev
A-EDev deleted the fix/translated-caption-requests branch November 14, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation player Video and audio playback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants