using System.ComponentModel.DataAnnotations; namespace Musify.Application.Configuration { /// Controls whether listeners without a session can stream music at all, and if so, /// how much of a track they get to hear before being cut off (a Spotify-style preview). public sealed class PlaybackConfiguration { public const string SectionName = "Playback"; /// When false (the default), every stream endpoint requires a signed-in user, exactly /// like before this setting existed. When true, an anonymous request is issued a stream ticket /// too, capped by if that is greater than zero. public bool AllowAnonymousListening { get; set; } /// How many seconds of a track an anonymous listener may hear, enforced by the /// Streaming Gateway clamping the byte range it will serve for that ticket. Zero (the default) /// means no cap: anonymous listeners hear the full track, same as a signed-in user. Ignored /// when is false. [Range(0, 3600)] public int AnonymousFragmentSeconds { get; set; } /// Bytes per second of the transcoded audio, used to turn /// into a byte cap for the stream ticket. Defaults to the app's own transcoder output (128 kbps /// AAC, AudioTranscoder:Ffmpeg:AudioBitrate) — update this alongside that setting if it /// ever changes, since the two aren't wired together. [Range(1, int.MaxValue)] public int EstimatedAudioBytesPerSecond { get; set; } = 16_000; } }