Use client-reported position for idle playback cleanup

This commit is contained in:
itsb
2026-08-13 16:41:45 -05:00
parent 916c3c9cc3
commit 499e64b1c3
4 changed files with 191 additions and 1 deletions
@@ -28,6 +28,7 @@ namespace MediaBrowser.Controller.Session
private readonly Lock _progressLock = new();
private Timer _progressTimer;
private PlaybackProgressInfo _lastProgressInfo;
private long? _lastPlaybackCheckInPositionTicks;
private bool _disposed;
@@ -124,6 +125,22 @@ namespace MediaBrowser.Controller.Session
/// <value>The last playback check in.</value>
public DateTime LastPlaybackCheckIn { get; set; }
/// <summary>
/// Gets the position reported by the client at the last playback check-in.
/// </summary>
/// <value>The position ticks, or <see langword="null"/> if the client did not report a position.</value>
[JsonIgnore]
public long? LastPlaybackCheckInPositionTicks
{
get
{
lock (_progressLock)
{
return _lastPlaybackCheckInPositionTicks;
}
}
}
/// <summary>
/// Gets or sets the last paused date.
/// </summary>
@@ -372,6 +389,7 @@ namespace MediaBrowser.Controller.Session
lock (_progressLock)
{
_lastPlaybackCheckInPositionTicks = progressInfo.PositionTicks;
_lastProgressInfo = progressInfo;
if (_progressTimer is null)