From 949cc09410e72d3e8896756a89641fb3f2869533 Mon Sep 17 00:00:00 2001 From: Gaimoydev <106746080+Gaimoydev@users.noreply.github.com> Date: Wed, 28 Oct 2026 19:35:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=8F=8C=E4=BA=BA?= =?UTF-8?q?=E5=92=8C=E5=A4=9A=E4=BA=BA=E4=B8=80=E8=B5=B7=E5=90=AC=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Provider/IListenTogetherSyncProvidable.cs | 17 +++++++ .../IMultiListenTogetherProvidable.cs | 22 +++++++++ .../Models/ProviderListenTogetherHeartbeat.cs | 14 ++++++ .../ProviderListenTogetherQueueReport.cs | 2 + .../Models/ProviderListenTogetherRoomState.cs | 40 +++++++++++++++ .../Models/ProviderListenTogetherStatus.cs | 3 ++ .../Models/ProviderMultiListenTogetherRoom.cs | 49 +++++++++++++++++++ 7 files changed, 147 insertions(+) create mode 100644 HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IListenTogetherSyncProvidable.cs create mode 100644 HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IMultiListenTogetherProvidable.cs create mode 100644 HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherHeartbeat.cs create mode 100644 HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherRoomState.cs create mode 100644 HyPlayer.PlayCore.Abstraction/Models/ProviderMultiListenTogetherRoom.cs diff --git a/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IListenTogetherSyncProvidable.cs b/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IListenTogetherSyncProvidable.cs new file mode 100644 index 0000000..746fe5f --- /dev/null +++ b/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IListenTogetherSyncProvidable.cs @@ -0,0 +1,17 @@ +using HyPlayer.PlayCore.Abstraction.Models; +using HyPlayer.PlayCore.Abstraction.Models.SingleItems; + +namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider; + +public interface IListenTogetherSyncProvidable : IListenTogetherProvidable +{ + public Task JoinListenTogetherRoomAsync(string roomId, string inviterId, CancellationToken ctk = new()); + + public Task SendListenTogetherHeartbeatAsync(string roomId, ProviderListenTogetherHeartbeat heartbeat, CancellationToken ctk = new()); + + public Task GetListenTogetherRoomStateAsync(string roomId, CancellationToken ctk = new()); + + public Task> GetListenTogetherQueueSongsAsync(IReadOnlyList itemIds, CancellationToken ctk = new()); + + public Task EndListenTogetherRoomAsync(string roomId, CancellationToken ctk = new()); +} diff --git a/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IMultiListenTogetherProvidable.cs b/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IMultiListenTogetherProvidable.cs new file mode 100644 index 0000000..7df8756 --- /dev/null +++ b/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IMultiListenTogetherProvidable.cs @@ -0,0 +1,22 @@ +using HyPlayer.PlayCore.Abstraction.Models; + +namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider; + +public interface IMultiListenTogetherProvidable : IProvider +{ + public Task CreateMultiListenTogetherRoomAsync(string seedItemId, CancellationToken ctk = new()); + + public Task JoinMultiListenTogetherRoomAsync(string roomId, string inviterId, CancellationToken ctk = new()); + + public Task GetMultiListenTogetherRoomAsync(CancellationToken ctk = new()); + + public Task SendMultiListenTogetherHeartbeatAsync(string roomId, CancellationToken ctk = new()); + + public Task> GetMultiListenTogetherQueueAsync(string roomId, CancellationToken ctk = new()); + + public Task RecommendMultiListenTogetherItemAsync(string roomId, string itemId, CancellationToken ctk = new()); + + public Task RequestMultiListenTogetherSkipAsync(string roomId, string itemId, string entryId, CancellationToken ctk = new()); + + public Task LeaveMultiListenTogetherRoomAsync(string roomId, CancellationToken ctk = new()); +} diff --git a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherHeartbeat.cs b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherHeartbeat.cs new file mode 100644 index 0000000..5a2c8be --- /dev/null +++ b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherHeartbeat.cs @@ -0,0 +1,14 @@ +namespace HyPlayer.PlayCore.Abstraction.Models; + +public sealed class ProviderListenTogetherHeartbeat +{ + public required string ItemId { get; init; } + + public bool IsPlaying { get; init; } + + public TimeSpan Position { get; init; } + + public string? UserId { get; init; } + + public long PlaylistVersion { get; init; } +} diff --git a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherQueueReport.cs b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherQueueReport.cs index fc5f601..bb77bbf 100644 --- a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherQueueReport.cs +++ b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherQueueReport.cs @@ -5,6 +5,8 @@ namespace HyPlayer.PlayCore.Abstraction.Models; public sealed class ProviderListenTogetherQueueReport { public required List Queue { get; init; } + + public List? RandomQueue { get; init; } public string? UserId { get; init; } public string PlayModeId { get; init; } = "seq"; public int ClientSeq { get; init; } diff --git a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherRoomState.cs b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherRoomState.cs new file mode 100644 index 0000000..76c3010 --- /dev/null +++ b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherRoomState.cs @@ -0,0 +1,40 @@ +namespace HyPlayer.PlayCore.Abstraction.Models; + +public sealed class ProviderListenTogetherRoomState +{ + public List DisplayItemIds { get; init; } = []; + + public List RandomItemIds { get; init; } = []; + + public string? PlayModeId { get; init; } + + public List Versions { get; init; } = []; + + public ProviderListenTogetherRemoteCommand? LastCommand { get; init; } +} + +public sealed class ProviderListenTogetherQueueVersion +{ + public required string UserId { get; init; } + + public long Version { get; init; } +} + +public sealed class ProviderListenTogetherRemoteCommand +{ + public required string CommandId { get; init; } + + public string? UserId { get; init; } + + public string? FormerItemId { get; init; } + + public string? TargetItemId { get; init; } + + public TimeSpan Position { get; init; } + + public bool IsPlaying { get; init; } + + public long ClientSeq { get; init; } + + public long ServerSeq { get; init; } +} diff --git a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherStatus.cs b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherStatus.cs index 091a2be..c0bbfaf 100644 --- a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherStatus.cs +++ b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherStatus.cs @@ -4,6 +4,9 @@ public sealed class ProviderListenTogetherStatus { public bool IsInRoom { get; init; } public string? RoomId { get; init; } + + public string? CreatorId { get; init; } + public bool IsMultiRoom { get; init; } public List Users { get; init; } = []; } diff --git a/HyPlayer.PlayCore.Abstraction/Models/ProviderMultiListenTogetherRoom.cs b/HyPlayer.PlayCore.Abstraction/Models/ProviderMultiListenTogetherRoom.cs new file mode 100644 index 0000000..132392d --- /dev/null +++ b/HyPlayer.PlayCore.Abstraction/Models/ProviderMultiListenTogetherRoom.cs @@ -0,0 +1,49 @@ +namespace HyPlayer.PlayCore.Abstraction.Models; + +public sealed class ProviderMultiListenTogetherRoom +{ + public required string RoomId { get; init; } + public string? CreatorId { get; init; } + public List Users { get; init; } = []; + public ProviderMultiListenTogetherPlayback? Playback { get; init; } + public bool CanRecommend { get; init; } = true; + public bool CanRequestSkip { get; init; } = true; +} + +public sealed class ProviderMultiListenTogetherPlayback +{ + public required string ItemId { get; init; } + public required string EntryId { get; init; } + public string? RecommenderId { get; init; } + public TimeSpan Position { get; init; } + public TimeSpan Duration { get; init; } + public long Version { get; init; } + public List NextItemIds { get; init; } = []; +} + +public sealed class ProviderMultiListenTogetherHeartbeat +{ + public ProviderMultiListenTogetherPlayback? Playback { get; init; } + public TimeSpan? Interval { get; init; } + public bool IsClosed { get; init; } +} + +public sealed class ProviderMultiListenTogetherQueueItem +{ + public required string ItemId { get; init; } + public required string EntryId { get; init; } + public required string Title { get; init; } + public string Artists { get; init; } = string.Empty; + public string? CoverUrl { get; init; } + public string? RecommenderId { get; init; } + public string RecommenderName { get; init; } = string.Empty; + public bool IsSystemRecommendation { get; init; } + public bool IsPlaying { get; init; } +} + +public sealed class ProviderMultiListenTogetherOperation +{ + public bool Succeeded { get; init; } + public string Message { get; init; } = string.Empty; + public ProviderMultiListenTogetherPlayback? Playback { get; init; } +}