Skip to content

feat(player): play live streams from their segments with the full DVR window - #2336

Merged
A-EDev merged 5 commits into
feat/live-segment-clockfrom
feat/live-full-dvr
Nov 23, 2026
Merged

A-EDev merged 5 commits into
feat/live-segment-clockfrom
feat/live-full-dvr

Conversation

@A-EDev

@A-EDev A-EDev commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • A live stream now plays from its formats' direct URLs, fetching segments by number (&sq=N), through a Media3 DASH source whose manifest is written locally from the segment clock. The window is YouTube's 12 hours instead of the HLS playlist's 60 minutes. HLS stays as the fallback when the response has no segment formats or the head cannot be read.
  • One request reads the head before start, while the session is armed. Media3 refreshes the manifest every segment as for any dynamic DASH stream, but locally, so live playback makes no manifest requests.
  • A segment past the head is held by the CDN and then answered with 204 and no body; it is raised as not ready and retried instead of being read as an empty segment.
  • Playback speed is held at 1.0 on this source, as in YouTube's live player.
  • The edge rule allows 20 s from the window end, since Media3 snaps the default live position to a segment start (16 s measured).

Emulator, LiveNOW FOX (24/7 news) and The Good Life Radio (24/7 music):

  • Seeks to -3 h, -6 h, -10 h and -11 h each started within about a second; at -3 h and -10 h the broadcast clock on screen matched the requested depth to the minute.
  • 60 minutes at the edge of LiveNOW FOX: 4 stalls, each a network timeout or reset on the emulator (0.44 to 0.79 Mbps). The HLS path on the same stream and network stalled 4 times in 31 minutes.
  • Manifest traffic: 0 requests in every minute on the segment source. The HLS path read 796 playlists, 730 MB of playlist text, in 31 minutes.
  • In background audio ("Listen in background"): 12 requests and about 950 KB a minute, audio segments only, no manifest requests.

Stacked on #2335; merge from the top of the stack down.

Related issue

Closes #1385

Change type

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

Validation

Run on the top of the stack (fix/live-stream-end), which contains this change:

  • ./gradlew :app:assembleGithubDebug: passed
  • ./gradlew :app:testGithubDebugUnitTest: 7,098 tests, 0 failures, 46 skipped
  • I ran any additional flavor-specific build or test tasks affected by this change: ktlintCheck, :app:compileFossDebugKotlin passed
  • I manually tested the affected behavior on an Android device or emulator.

Test device and Android version: Emulator, Android 17 (API 37), phone 1080x2400

Screenshots or recordings

Risk and compatibility

  • Playback path for live streams. The template uses the stream's average segment length, so on streams whose segments vary it drifts from the media by about 15 s an hour of watching (measured), in the direction that keeps playback correct; deep seeks on such streams can land up to about a minute off.

  • After a stall on a stream with DVR, playback stays behind live (as on YouTube) instead of creeping back at 1.03x; the grey badge shows it and a tap returns to live.

  • Live streams whose URLs need an n transform (ANDROID_VR) stay on HLS.

  • 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.

@github-actions github-actions Bot added documentation Improvements or additions to documentation player Video and audio playback ui Compose UI, theming, or Material 3 surfaces labels Nov 23, 2026
fix(player): end playback when a live stream ends
fix(player): refresh live stream URLs before they expire
@A-EDev
A-EDev merged commit 4128a62 into feat/live-segment-clock Nov 23, 2026
@A-EDev
A-EDev deleted the feat/live-full-dvr branch November 23, 2026 19:17
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 ui Compose UI, theming, or Material 3 surfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant