Commit Graph

1757 Commits

Author SHA1 Message Date
Simon Gardling ed6270552b Recover stuck live playback when play is pressed
Adds recoverFromStuck() and rewires the play-button click handler to
call it before falling through to the normal play path.

When the player has dropped into STATE_IDLE after a fatal error or
STATE_ENDED on a slipped live window, plain play() is a no-op until we
re-prepare. recoverFromStuck() reloads the cached media source and, on
live, snaps to the live edge -- so pressing play recovers in place
instead of forcing the user to back out of the video and reopen it.

Non-live STATE_ENDED is left alone so the existing seek-to-0 replay
path that VideoDetailView's onSourceEnded handler primes via
setIsReplay(true) keeps working.

The play handler also tightens the existing replay rewind: the previous
'contentPosition >= duration' check would seekTo(0) on live streams
because Player.duration is C.TIME_UNSET (a large negative value); the
new 'dur > 0 && pos >= dur' guard skips that for live and only rewinds
finished VODs.
2026-05-01 01:15:42 -04:00
Simon Gardling 9639c2a167 Auto-reload live streams on transient errors
Adds a silent retry path for live HLS playback when the player raises a
transient I/O or parsing error: tryLiveAutoReload() reloads the source
and snaps to the live edge, with a 3s debounce and a 5-attempt cap so a
permanently broken source does not spin in a loop.

Triggered from:
  - onPlayerError, for the error codes a transient outage typically
    produces (IO_NETWORK_*, IO_BAD_HTTP_STATUS, IO_INVALID_HTTP_*,
    IO_UNSPECIFIED, PARSING_CONTAINER_MALFORMED, PARSING_MANIFEST_MALFORMED)
  - onPlaybackStateChanged, when STATE_ENDED hits on a live session
    (covers cases where the player cannot raise an error before the
    timeline empties)

On STATE_READY the attempts counter resets so future hiccups get a fresh
budget. The counters also reset on swapSourceInternal/clear so a previous
session's attempts cannot bleed into the next.

The dispatch is gated on the sticky _isLiveSession flag rather than the
dynamic isCurrentMediaItemLive: the latter flips false during the
transient empty timeline that a reload produces, which would otherwise
break the retry chain after the first attempt.
2026-05-01 01:15:42 -04:00
Simon Gardling b5caea6556 Expose live-stream state and edge detection
Foundational hooks for follow-up live-recovery and UI work; no behaviour
change on its own.

  - isLive: whether the current media item is live
  - liveOffsetMs: offset behind wall-clock live edge
  - targetLiveOffsetMs: manifest's intended offset (null if not declared)
  - isAtLiveEdge: target-aware boundary, with a 45s fallback for sources
    (e.g. YouTube HLS) that do not declare targetOffsetMs
  - seekToLiveEdge(): wraps Player.seekToDefaultPosition() for live items
  - onLiveChanged event, fired from onTimelineChanged/onMediaItemTransition
  - _isLiveSession sticky flag: stays true through the transient empty
    timeline the player goes through during a reload, so consumers can
    distinguish 'a live source is loaded' from the dynamic isLive bit

LIVE_EDGE_TOLERANCE_MS = 5s and LIVE_EDGE_FALLBACK_THRESHOLD_MS = 45s
are tuned to match what YouTube's HLS player reports (currentLiveOffset
sits at ~25-30s natively even at the edge, so a tighter threshold would
report 'behind' forever).
2026-05-01 01:15:42 -04:00
Simon Gardling 4bb09ec92e Fix BehindLiveWindowException recovery on live HLS
The 'error is BehindLiveWindowException' check in onPlayerError was
always false (Kotlin compiler had been warning about it). The actual
exception is wrapped as the *cause* of an ExoPlaybackException, with
errorCode 1002 (ERROR_CODE_BEHIND_LIVE_WINDOW). This made the existing
recovery branch dead code, so when the live window slipped past the
player it would silently drop into STATE_IDLE and the user had to back
out of the video and reopen it.

Test the cause and the error code so the branch actually fires, and
snap to the live edge with seekToDefaultPosition() after both the
BehindLiveWindow and PlaylistStuckException reloads so the user lands
where the player would naturally play.
2026-05-01 01:15:42 -04:00
Simon Gardling 7a6b185e9d Format negative durations correctly
formatDuration() previously emitted strings like '00:-49' for negative
values because the modulo operations propagated the sign. This shows up
on live streams that briefly report a negative position during reload,
and as the basis for a planned 'behind live edge' indicator.

Recurse on the absolute value when negative so we get a clean -MM:SS
(or -HH:MM:SS) format.
2026-05-01 01:15:42 -04:00
Koen cf3fc61f6a Merge branch 'request-modifiers' into 'master'
Improve request modifier support for casting and downloads

See merge request videostreaming/grayjay!171
2026-04-30 15:32:54 +00:00
Koen J d03019f0b7 Fixes for fdroid and playstore automation. 2026-04-30 12:24:50 +02:00
Koen J f1ce0078fd Switch to rel.grayjay.app 381 380 2026-04-30 11:03:44 +02:00
Koen J 32de3649ef Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay 379 2026-04-30 10:10:17 +02:00
Koen J 1a301236da Changed background download to default. 2026-04-30 10:04:44 +02:00
Koen J c695379885 Fix for casting downloaded videos (UMP, requires redownloading). 378 2026-04-29 16:53:24 +02:00
Koen J 73466892f7 Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay 2026-04-29 13:13:37 +02:00
Koen J bb8a9d4dd7 Fixed notification system issues and plugin auto update. 2026-04-29 13:07:14 +02:00
Koen J 43ed2b16ab Hide browser interop warning. 2026-04-29 11:23:19 +02:00
Koen J 64938dba6c Changed default setting on clear cookies on login. 377 376 2026-04-27 12:14:52 +02:00
Koen 8b7d51cd70 Merge branch 'possiblebusyfix' into 'master'
Possible busy fix

See merge request videostreaming/grayjay!173
2026-04-27 10:14:01 +00:00
Koen ace7ca1551 Possible busy fix 2026-04-27 10:14:01 +00:00
Koen J 22b5adc4b8 Fix for #2614 2026-04-22 15:09:51 +02:00
Koen J 0f7fb9059b Made sub exchange default and fixed #2930. Also fixed unrelated export issues. 2026-04-22 15:02:22 +02:00
Koen J 05afa12274 Fix for #2068 2026-04-22 12:47:15 +02:00
Koen J b4a280cee8 Fixed up translation 2026-04-22 11:17:57 +02:00
koen-futo ac5d7eab2a Merge pull request #2135 from ddrews-de/patch-1
Update strings.xml for German Language
2026-04-22 11:14:07 +02:00
koen-futo b624d45ab6 Merge pull request #3132 from jraleman/master
feat: add support to sort downloads by type
2026-04-22 11:12:39 +02:00
koen-futo 5340088ada Merge pull request #3133 from GorlovDanila/patch-1
fixed bug: Playlist title blocks text/element below it
2026-04-22 11:09:53 +02:00
Koen J fcab0f5ee5 Potential fix for #3247 2026-04-22 10:23:40 +02:00
Koen J 80c9b27d48 Build fix 2026-04-17 15:33:15 +02:00
Koen J f54216d52f Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay 2026-04-16 16:42:36 +02:00
Koen J fea69d265a Article open bug. 2026-04-16 16:42:13 +02:00
Koen 030086e769 Merge branch 'marcus/cast-button-sync' into 'master'
casting: set cast button to inactive color when device is disconnected

See merge request videostreaming/grayjay!172
2026-04-16 14:40:04 +00:00
Koen 81516c31fb Merge branch 'marcus/casting-device-remove-comment' into 'master'
casting: remove old commented out code

See merge request videostreaming/grayjay!170
2026-04-16 14:39:55 +00:00
Marcus Hanestad 3d13a21700 casting: set cast button to inactive color when device is disconnected 2026-04-16 10:12:16 +02:00
Stefan cd90497a59 Improve request modifier support for casting and downloads 2026-04-08 13:32:39 +01:00
Koen J c14d2580ee Update dependencies. 2026-04-01 13:40:35 +02:00
Marcus Hanestad 795259564d casting: remove old commented out code 2026-03-27 14:46:40 +01:00
Kelvin 81d0b08306 Merge branch 'tlg/opinion-dupe-bug' into 'master'
Opinion Dupe Bug

See merge request videostreaming/grayjay!169
2026-03-26 21:42:44 +00:00
Tim Giroux 9a97a901fb dupe opinion bug 2026-03-26 13:10:29 -05:00
Koen J d9b23eff62 Build fix. 2026-03-24 13:02:06 +01:00
Koen 8591deaf86 Merge branch 'plugin-init-failures' into 'master'
Handle plugin init failures per source

See merge request videostreaming/grayjay!168
2026-03-20 11:53:19 +00:00
Stefan 22c5581d00 Handle plugin init failures per source 2026-03-20 11:53:19 +00:00
Koen 6e815dc868 Merge branch 'new-plugins' into 'master'
Add Radio Browser, Red Bull TV and FOSDEM plugins

See merge request videostreaming/grayjay!167
2026-03-20 11:52:53 +00:00
Stefan 1ac409561c Add Radio Browser, Red Bull TV and FOSDEM plugins 2026-03-20 11:52:53 +00:00
Koen J 897ba8a560 Added error handling to onConsoleMessage. 2026-03-20 11:35:16 +01:00
Koen J 8982ea2289 Fix for Furilabs phone (thanks @Aleks K) 2026-03-16 15:52:31 +01:00
Koen f693f1e6b3 Edit deploy-stable.sh 375 2026-03-12 18:09:21 +00:00
Koen e118bc09b9 Edit deploy-unstable.sh 2026-03-12 18:07:57 +00:00
Kelvin 5ba77b60c8 Merge branch 'marcus/fcast-fix' into 'master'
fix fcast sender sdk

See merge request videostreaming/grayjay!166
2026-03-12 17:42:35 +00:00
Kelvin K 19b63ba372 Remove transient from plugin settings, submods 2026-03-12 12:34:04 -05:00
Marcus Hanestad 5fc39d3bb3 fix fcast sender sdk 2026-03-11 12:51:17 -05:00
Koen 1d046538f8 Merge branch 'marcus/fcast-sdk-0.4.1' into 'master'
upgrade fcast sdk to 0.4.1

See merge request videostreaming/grayjay!165
2026-03-10 13:30:43 +00:00
Marcus Hanestad 9f10b86861 upgrade fcast sdk to 0.4.1 2026-03-10 08:28:52 -05:00