remove redundant restAPI
Build Plugin / build (push) Successful in 2m46s
Release Plugin / build-and-release (push) Successful in 2m44s

playback is controlled by state machine
This commit is contained in:
2025-12-30 14:37:27 +01:00
parent 29cd6dfaeb
commit a199fe452c
9 changed files with 824 additions and 523 deletions
@@ -9,9 +9,14 @@ namespace Jellyfin.Plugin.JellyLMS.Models;
public enum PlaybackState
{
/// <summary>
/// Playback is stopped.
/// Device connected, no media loaded.
/// </summary>
Stopped,
Idle,
/// <summary>
/// Play command sent, waiting for LMS to confirm playback started.
/// </summary>
Loading,
/// <summary>
/// Playback is active.
@@ -21,7 +26,84 @@ public enum PlaybackState
/// <summary>
/// Playback is paused.
/// </summary>
Paused
Paused,
/// <summary>
/// Position change in progress.
/// </summary>
Seeking,
/// <summary>
/// Playback failed with an error.
/// </summary>
Error,
/// <summary>
/// Playback has ended.
/// </summary>
Stopped
}
/// <summary>
/// Types of playback errors.
/// </summary>
public enum PlaybackErrorType
{
/// <summary>
/// No error.
/// </summary>
None,
/// <summary>
/// Operation timed out waiting for LMS response.
/// </summary>
Timeout,
/// <summary>
/// Network error communicating with LMS.
/// </summary>
NetworkError,
/// <summary>
/// LMS returned an error.
/// </summary>
LmsError,
/// <summary>
/// Error with the audio stream from Jellyfin.
/// </summary>
StreamError,
/// <summary>
/// Unknown error.
/// </summary>
Unknown
}
/// <summary>
/// Contains details about a playback error.
/// </summary>
public class PlaybackErrorInfo
{
/// <summary>
/// Gets or sets the type of error.
/// </summary>
public PlaybackErrorType ErrorType { get; set; }
/// <summary>
/// Gets or sets the error message.
/// </summary>
public string Message { get; set; } = string.Empty;
/// <summary>
/// Gets or sets when the error occurred.
/// </summary>
public DateTime OccurredAt { get; set; }
/// <summary>
/// Gets or sets the number of retry attempts made.
/// </summary>
public int RetryCount { get; set; }
}
/// <summary>
@@ -67,7 +149,12 @@ public class LmsPlaybackSession
/// <summary>
/// Gets or sets the current playback state.
/// </summary>
public PlaybackState State { get; set; } = PlaybackState.Stopped;
public PlaybackState State { get; set; } = PlaybackState.Idle;
/// <summary>
/// Gets or sets the last error that occurred during playback.
/// </summary>
public PlaybackErrorInfo? LastError { get; set; }
/// <summary>
/// Gets or sets the current playback position in ticks.