Skip to content

Add progress bar, timeline and seeking for replay/catchup content#13

Open
duromir wants to merge 1 commit intonirvana-7777:Omegafrom
duromir:fix/progress-bar-timeline
Open

Add progress bar, timeline and seeking for replay/catchup content#13
duromir wants to merge 1 commit intonirvana-7777:Omegafrom
duromir:fix/progress-bar-timeline

Conversation

@duromir
Copy link
Copy Markdown

@duromir duromir commented Feb 13, 2026

Summary

  • Progress bar & timeline: Implements GetStreamTimes() for both live TV (EPG-based duration) and replay/catchup (fixed start/end times), so Kodi displays the correct programme duration and playback position.
  • Seeking via local redirect proxy: Introduces StreamRedirectProxy, a local HTTP server that intercepts ffmpegdirect seek requests and generates fresh AES-encrypted URLs with the correct t= timestamp. Uses 302 redirects so FFmpeg resolves relative HLS segment URLs correctly.
  • Fresh session IDs per seek: Each seek generates a new UUID session ID to avoid CDN 403 rejections caused by session ID reuse while a previous stream is still considered "active" server-side.

Details

Problem

The EON CDN requires the seek timestamp (t=) inside an AES-CBC encrypted payload. ffmpegdirect's catchup mechanism can only substitute {utc} in the URL but cannot re-encrypt the payload. Additionally, reusing the same session ID across seeks causes the CDN to reject requests with HTTP 403.

Solution

  • A local TCP server (StreamRedirectProxy) listens on a random loopback port
  • The catchup URL format is set to http://127.0.0.1:<port>/stream?t={utc}
  • On each seek, the proxy:
    1. Parses the timestamp from the request
    2. Generates a fresh UUID session ID
    3. Builds a new AES-CBC encrypted URL with the correct timestamp and session ID
    4. Returns a 302 redirect to the encrypted CDN URL
  • URL caching (10s window) handles ffmpegdirect retries for the same timestamp
  • Server time offset is computed once at stream start to keep ctime in sync with the CDN

Files changed

  • StreamRedirectProxy.cpp/.h — New local redirect proxy with AES encryption
  • PVREon.cppGetStreamTimes(), proxy setup in GetStreamProperties(), live EPG fetching for progress bar
  • PVREon.h — New members for playback state tracking and proxy
  • CMakeLists.txt — Added new source files

Test plan

  • Replay/catchup: progress bar shows correct programme duration
  • Replay/catchup: seeking (FF/rewind) works reliably (51 seeks, 0 errors in testing)
  • Replay/catchup: normal playback does not jump to next programme
  • Live TV: progress bar shows current programme duration
  • Channel switching works without proxy conflicts
  • Test on Linux (currently verified on macOS only — uses POSIX sockets, should work)

🤖 Generated with Claude Code

- Implement GetStreamTimes() for both live TV (EPG-based progress) and
  replay (fixed programme duration) so Kodi displays a proper timeline
- Force ffmpegdirect for replay content with catchup buffer times,
  programme start/end, and playback_as_live=false
- Add StreamRedirectProxy: a local HTTP server that generates fresh
  AES-CBC encrypted URLs for each seek position, since the t= timestamp
  is inside the encrypted payload and cannot be appended as a plain
  query parameter
- Use 302 redirects so FFmpeg resolves relative HLS segment URLs against
  the CDN, not the local proxy
- Generate a new session ID (UUID) per seek to prevent the CDN from
  rejecting requests when the previous session is still considered active
- Cache encrypted URLs for identical timestamp retries
- Compute server time offset once at stream start for accurate ctime
  values without per-seek API calls
- Track current playback state (live/replay, channel, start/end times)
  for GetStreamTimes() reporting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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