melodee icon indicating copy to clipboard operation
melodee copied to clipboard

User Device Profiles

Open sphildreth opened this issue 10 months ago • 0 comments

Description

Add per-user and per-player/device transcoding profiles so different clients (e.g., mobile vs desktop) automatically receive the desired codec/bitrate (or direct play) without changing settings each time.

Requirements

  • New setting to disable/enable this feature us "userDeviceProfile.enabled" default to true.
    • When this is false the option does not appear in the Blazor UI
    • When this is false the ability to transcode based on user device profiles is disabled/skipped
  • Add a Player/Device model associated to a user (create/update/list/delete).
  • Identify the requesting player/device for each stream request using:
    • OpenSubsonic/Subsonic: c parameter (client name) plus a stable device/player identifier when available.
    • Jellyfin: client/device identifiers (e.g., Client + DeviceId from the request).
    • Native API/Web player: a Melodee-defined player identifier (e.g., header/param) with a deterministic fallback if missing.
  • Support transcoding profile assignment with precedence:
    • Per-player override (highest priority)
    • Per-user default override
    • Global default (fallback; default = Direct Play / No Transcoding)
  • Transcoding profiles must support:
    • Direct Play (no transcoding)
    • Target codec/container: at minimum MP3 and Opus
    • Max bitrate (kbps)
    • Optional resample rate (Hz)
  • Enforce transcoding decisions consistently for:
    • Web player streaming
    • OpenSubsonic /rest/stream
    • Jellyfin streaming (if applicable in Melodee’s Jellyfin compatibility layer)
  • Provide deterministic behavior when player identity is missing/unknown:
    • Either auto-register a new Player record OR fall back to user default/global default (choose one approach and document it).
  • Add observability for troubleshooting:
    • Log effective streaming decision (direct/transcoded) and selected profile details.
    • Optionally expose decision via response headers.
  • Documentation
    • Add new jekyll page "user-device-profiles.md" that is linked from the "Core Concepts" nav menu in jekyll that provides detailed information about this new feature including all options and usage examples.
    • Add a new feature line to the root README.md document
  • Tests
    • Must have ample unit tests both Happy Path and Edge cases around this new feature

Success Criteria

  • A user can have two registered players: “Mobile” and “Desktop”.
  • Mobile player can be assigned Opus @ 96 kbps and Desktop can be assigned Direct Play / Lossless.
  • Streaming the same song from Mobile results in transcoded output per profile; streaming from Desktop results in direct play.
  • Per-player overrides always win over per-user defaults; per-user defaults win over global defaults.
  • The transcoding decision is applied consistently across Web player, OpenSubsonic /rest/stream, and Jellyfin streaming (if applicable).
  • Unknown/missing player identity follows a deterministic rule and does not break streaming.
  • Automated tests cover:
    • precedence rules
    • mobile vs desktop behavior difference
    • player identification inputs (Subsonic c, Jellyfin device fields, native/web identifier)
  • Logs (and/or headers) show the effective decision and selected profile for each stream request.

sphildreth avatar Jan 10 '26 21:01 sphildreth