2 Commits
Author SHA1 Message Date
dtourolle b85fbc2d90 Track remote volume to prevent unexpcted changes change
Release Plugin / build-and-release (push) Successful in 2m43s
Build Plugin / build (push) Successful in 2m54s
2026-01-25 19:20:35 +01:00
Gitea Actions f5f202794f Update manifest.json for v1.0.1 2025-12-30 13:43:10 +00:00
2 changed files with 34 additions and 16 deletions
@@ -59,6 +59,9 @@ public class LmsSessionController : ISessionController, IDisposable
_libraryManager = libraryManager;
_stateMachine = new PlaybackStateMachine(logger);
_statusPoller = new LmsStatusPoller(lmsClient, logger);
// Start status polling immediately to keep volume in sync
StartProgressTimer();
}
private static PluginConfiguration Config => Plugin.Instance?.Configuration ?? new PluginConfiguration();
@@ -295,7 +298,7 @@ public class LmsSessionController : ISessionController, IDisposable
// Stop any existing timer
_progressTimer?.Dispose();
// Report progress every 2 seconds
// Poll status every 2 seconds (for progress reporting when playing and volume sync always)
_progressTimer = new Timer(
async _ => await ReportPlaybackProgressAsync().ConfigureAwait(false),
null,
@@ -305,32 +308,37 @@ public class LmsSessionController : ISessionController, IDisposable
private void StopProgressTimer()
{
_progressTimer?.Dispose();
_progressTimer = null;
// Don't actually stop the timer - keep polling for volume updates
// This ensures Jellyfin stays in sync with the device volume
// even when not playing media
}
private async Task ReportPlaybackProgressAsync()
{
// Don't report during Loading, Seeking, or Error states
var currentState = _stateMachine.CurrentState;
if (currentState == PlaybackState.Loading
|| currentState == PlaybackState.Seeking
|| currentState == PlaybackState.Error
|| currentState == PlaybackState.Stopped
|| currentState == PlaybackState.Idle
|| !CurrentItemId.HasValue)
{
return;
}
try
{
// Always poll status to keep volume in sync, even when not playing
var status = await _lmsClient.GetPlayerStatusAsync(_player.MacAddress).ConfigureAwait(false);
if (status == null)
{
return;
}
// Update cached volume so Jellyfin stays in sync with device
_player.Volume = status.Volume;
// Don't report playback progress during Loading, Seeking, Error, Stopped, or Idle states
var currentState = _stateMachine.CurrentState;
if (currentState == PlaybackState.Loading
|| currentState == PlaybackState.Seeking
|| currentState == PlaybackState.Error
|| currentState == PlaybackState.Stopped
|| currentState == PlaybackState.Idle
|| !CurrentItemId.HasValue)
{
return;
}
// LMS reports time relative to the current stream, but after seeking
// we're playing a transcoded stream that starts at the seek position.
// Add the seek offset to get the actual track position.
@@ -812,7 +820,9 @@ public class LmsSessionController : ISessionController, IDisposable
_cancellationTokenSource.Cancel();
_cancellationTokenSource.Dispose();
StopProgressTimer();
// Actually stop the timer when disposing
_progressTimer?.Dispose();
_progressTimer = null;
// Reset state machine
_stateMachine.Reset();
+8
View File
@@ -7,6 +7,14 @@
"owner": "dtourolle",
"category": "Music",
"versions": [
{
"version": "1.0.1",
"changelog": "Release 1.0.1",
"targetAbi": "10.10.0.0",
"sourceUrl": "https://gitea.tourolle.paris/dtourolle/jellyLMS/releases/download/v1.0.1/jellylms_1.0.1.0.zip",
"checksum": "093a1821b86a220cdfad49c3d93345a7",
"timestamp": "2025-12-30T13:43:10Z"
},
{
"version": "1.0.0",
"changelog": "Release 1.0.0",