Adds playback preferences and auto-persisted playback state to user settings

This commit is contained in:
BinaryAlley committed 2026-10-15 21:09:38 +03:00
1 parent aab36dcd29
commit dd76309ded
81 files changed
+6102 -173

No files matched your search

@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.UsersManagement;
/// <summary>
/// Data transfer object for the playback state a user last reported to the player. The player writes these values automatically, and they are not part of the settings the user edits.
/// </summary>
[DebuggerDisplay("Volume: {Volume}; IsMuted: {IsMuted}")]
public class PlaybackStateDto
{
/// <summary>
/// Gets or sets the last volume the player reported, as a value between 0 and 1.
/// </summary>
public double? Volume { get; set; }
/// <summary>
/// Gets or sets the last mute state the player reported.
/// </summary>
public bool? IsMuted { get; set; }
}
@@ -1,4 +1,5 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
using System;
using System.Diagnostics;
#endregion
@@ -58,4 +59,29 @@ public class UserSettingsDto
/// external servers, which those servers could observe; stripping them removes that possibility, at the cost of the look of the book.
/// </summary>
public bool ShouldPreserveBookStyles { get; set; }
/// <summary>
/// Gets or sets whether the player keeps downloading a track while playback is paused, or not, up to the entire file.
/// </summary>
public bool? ShouldKeepDownloadingWhilePaused { get; set; }
/// <summary>
/// Gets or sets whether the player continues playback at the end of an album or artist, or not.
/// </summary>
public bool? ShouldAutoplay { get; set; }
/// <summary>
/// Gets or sets whether the player transitions between consecutive tracks without a gap, or not.
/// </summary>
public bool? IsGaplessPlaybackEnabled { get; set; }
/// <summary>
/// Gets or sets the way ReplayGain normalization is applied to the tracks the user plays.
/// </summary>
public ReplayGainMode? ReplayGainMode { get; set; }
/// <summary>
/// Gets or sets the quality cap applied to the audio the server normalizes for the user.
/// </summary>
public PlaybackStreamingQuality? StreamingQuality { get; set; }
}
@@ -0,0 +1,35 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the quality cap applied to the audio the server normalizes (remuxes or transcodes) for a user.
/// </summary>
/// <remarks>
/// The caps apply only to audio the server has to change; a track that is played directly is always delivered as it was stored.
/// </remarks>
[DebuggerDisplay("{ToString()}")]
public enum PlaybackStreamingQuality
{
/// <summary>
/// The server chooses the quality, with no explicit cap.
/// </summary>
Auto,
/// <summary>
/// Normalized audio is capped at 96 kbps.
/// </summary>
Low,
/// <summary>
/// Normalized audio is capped at 160 kbps.
/// </summary>
Medium,
/// <summary>
/// Normalized audio is capped at 320 kbps.
/// </summary>
High,
}
@@ -0,0 +1,28 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
/// <summary>
/// Enumeration for the ways ReplayGain normalization is applied to the tracks a user plays.
/// </summary>
[DebuggerDisplay("{ToString()}")]
public enum ReplayGainMode
{
/// <summary>
/// ReplayGain is not applied. Tracks play at the loudness at which they were stored.
/// </summary>
Off,
/// <summary>
/// Each track is normalized using its own ReplayGain track gain, so tracks from different albums play at a similar loudness.
/// </summary>
Track,
/// <summary>
/// Each track is normalized using the ReplayGain album gain of the album it belongs to, so an album keeps its relative loudness
/// while albums play at a similar loudness to each other.
/// </summary>
Album,
}
@@ -12,5 +12,7 @@ public static partial class ApiRoutes
{
public const string GET_USER_SETTINGS = "users/me/settings";
public const string UPDATE_USER_SETTINGS = "users/me/settings";
public const string GET_PLAYBACK_STATE = "users/me/settings/playback-state";
public const string UPDATE_PLAYBACK_STATE = "users/me/settings/playback-state";
}
}
@@ -13,5 +13,7 @@ public static partial class WebRoutes
public const string INDEX = "{culture}/tools/settings";
public const string GET_USER_SETTINGS = "{culture}/tools/settings/api-get-user-settings";
public const string UPDATE_USER_SETTINGS = "{culture}/tools/settings/api-update-user-settings";
public const string GET_PLAYBACK_STATE = "{culture}/tools/settings/api-get-playback-state";
public const string UPDATE_PLAYBACK_STATE = "{culture}/tools/settings/api-update-playback-state";
}
}