aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model')
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupInfoDto.cs58
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupInfoView.cs42
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupQueueMode.cs18
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupRepeatMode.cs23
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupShuffleMode.cs18
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupStateType.cs28
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupStateUpdate.cs31
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupUpdate.cs30
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupUpdateType.cs8
-rw-r--r--MediaBrowser.Model/SyncPlay/JoinGroupRequest.cs16
-rw-r--r--MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs74
-rw-r--r--MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs58
-rw-r--r--MediaBrowser.Model/SyncPlay/PlaybackRequest.cs34
-rw-r--r--MediaBrowser.Model/SyncPlay/PlaybackRequestType.cs71
-rw-r--r--MediaBrowser.Model/SyncPlay/QueueItem.cs31
-rw-r--r--MediaBrowser.Model/SyncPlay/RequestType.cs33
-rw-r--r--MediaBrowser.Model/SyncPlay/SendCommand.cs45
-rw-r--r--MediaBrowser.Model/SyncPlay/SendCommandType.cs11
-rw-r--r--MediaBrowser.Model/SyncPlay/SyncPlayBroadcastType.cs28
-rw-r--r--MediaBrowser.Model/SyncPlay/UtcTimeResponse.cs21
20 files changed, 548 insertions, 130 deletions
diff --git a/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs b/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs
new file mode 100644
index 000000000..8c0960b83
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Class GroupInfoDto.
+ /// </summary>
+ public class GroupInfoDto
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="GroupInfoDto"/> class.
+ /// </summary>
+ /// <param name="groupId">The group identifier.</param>
+ /// <param name="groupName">The group name.</param>
+ /// <param name="state">The group state.</param>
+ /// <param name="participants">The participants.</param>
+ /// <param name="lastUpdatedAt">The date when this DTO has been created.</param>
+ public GroupInfoDto(Guid groupId, string groupName, GroupStateType state, IReadOnlyList<string> participants, DateTime lastUpdatedAt)
+ {
+ GroupId = groupId;
+ GroupName = groupName;
+ State = state;
+ Participants = participants;
+ LastUpdatedAt = lastUpdatedAt;
+ }
+
+ /// <summary>
+ /// Gets the group identifier.
+ /// </summary>
+ /// <value>The group identifier.</value>
+ public Guid GroupId { get; }
+
+ /// <summary>
+ /// Gets the group name.
+ /// </summary>
+ /// <value>The group name.</value>
+ public string GroupName { get; }
+
+ /// <summary>
+ /// Gets the group state.
+ /// </summary>
+ /// <value>The group state.</value>
+ public GroupStateType State { get; }
+
+ /// <summary>
+ /// Gets the participants.
+ /// </summary>
+ /// <value>The participants.</value>
+ public IReadOnlyList<string> Participants { get; }
+
+ /// <summary>
+ /// Gets the date when this DTO has been created.
+ /// </summary>
+ /// <value>The date when this DTO has been created.</value>
+ public DateTime LastUpdatedAt { get; }
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/GroupInfoView.cs b/MediaBrowser.Model/SyncPlay/GroupInfoView.cs
deleted file mode 100644
index f4c685998..000000000
--- a/MediaBrowser.Model/SyncPlay/GroupInfoView.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-#nullable disable
-
-using System.Collections.Generic;
-
-namespace MediaBrowser.Model.SyncPlay
-{
- /// <summary>
- /// Class GroupInfoView.
- /// </summary>
- public class GroupInfoView
- {
- /// <summary>
- /// Gets or sets the group identifier.
- /// </summary>
- /// <value>The group identifier.</value>
- public string GroupId { get; set; }
-
- /// <summary>
- /// Gets or sets the playing item id.
- /// </summary>
- /// <value>The playing item id.</value>
- public string PlayingItemId { get; set; }
-
- /// <summary>
- /// Gets or sets the playing item name.
- /// </summary>
- /// <value>The playing item name.</value>
- public string PlayingItemName { get; set; }
-
- /// <summary>
- /// Gets or sets the position ticks.
- /// </summary>
- /// <value>The position ticks.</value>
- public long PositionTicks { get; set; }
-
- /// <summary>
- /// Gets or sets the participants.
- /// </summary>
- /// <value>The participants.</value>
- public IReadOnlyList<string> Participants { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/SyncPlay/GroupQueueMode.cs b/MediaBrowser.Model/SyncPlay/GroupQueueMode.cs
new file mode 100644
index 000000000..5c9c2627b
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/GroupQueueMode.cs
@@ -0,0 +1,18 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Enum GroupQueueMode.
+ /// </summary>
+ public enum GroupQueueMode
+ {
+ /// <summary>
+ /// Insert items at the end of the queue.
+ /// </summary>
+ Queue = 0,
+
+ /// <summary>
+ /// Insert items after the currently playing item.
+ /// </summary>
+ QueueNext = 1
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/GroupRepeatMode.cs b/MediaBrowser.Model/SyncPlay/GroupRepeatMode.cs
new file mode 100644
index 000000000..4895e57b7
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/GroupRepeatMode.cs
@@ -0,0 +1,23 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Enum GroupRepeatMode.
+ /// </summary>
+ public enum GroupRepeatMode
+ {
+ /// <summary>
+ /// Repeat one item only.
+ /// </summary>
+ RepeatOne = 0,
+
+ /// <summary>
+ /// Cycle the playlist.
+ /// </summary>
+ RepeatAll = 1,
+
+ /// <summary>
+ /// Do not repeat.
+ /// </summary>
+ RepeatNone = 2
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/GroupShuffleMode.cs b/MediaBrowser.Model/SyncPlay/GroupShuffleMode.cs
new file mode 100644
index 000000000..de860883c
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/GroupShuffleMode.cs
@@ -0,0 +1,18 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Enum GroupShuffleMode.
+ /// </summary>
+ public enum GroupShuffleMode
+ {
+ /// <summary>
+ /// Sorted playlist.
+ /// </summary>
+ Sorted = 0,
+
+ /// <summary>
+ /// Shuffled playlist.
+ /// </summary>
+ Shuffle = 1
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/GroupStateType.cs b/MediaBrowser.Model/SyncPlay/GroupStateType.cs
new file mode 100644
index 000000000..7aa454f92
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/GroupStateType.cs
@@ -0,0 +1,28 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Enum GroupState.
+ /// </summary>
+ public enum GroupStateType
+ {
+ /// <summary>
+ /// The group is in idle state. No media is playing.
+ /// </summary>
+ Idle = 0,
+
+ /// <summary>
+ /// The group is in wating state. Playback is paused. Will start playing when users are ready.
+ /// </summary>
+ Waiting = 1,
+
+ /// <summary>
+ /// The group is in paused state. Playback is paused. Will resume on play command.
+ /// </summary>
+ Paused = 2,
+
+ /// <summary>
+ /// The group is in playing state. Playback is advancing.
+ /// </summary>
+ Playing = 3
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/GroupStateUpdate.cs b/MediaBrowser.Model/SyncPlay/GroupStateUpdate.cs
new file mode 100644
index 000000000..7f7deb86b
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/GroupStateUpdate.cs
@@ -0,0 +1,31 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Class GroupStateUpdate.
+ /// </summary>
+ public class GroupStateUpdate
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="GroupStateUpdate"/> class.
+ /// </summary>
+ /// <param name="state">The state of the group.</param>
+ /// <param name="reason">The reason of the state change.</param>
+ public GroupStateUpdate(GroupStateType state, PlaybackRequestType reason)
+ {
+ State = state;
+ Reason = reason;
+ }
+
+ /// <summary>
+ /// Gets the state of the group.
+ /// </summary>
+ /// <value>The state of the group.</value>
+ public GroupStateType State { get; }
+
+ /// <summary>
+ /// Gets the reason of the state change.
+ /// </summary>
+ /// <value>The reason of the state change.</value>
+ public PlaybackRequestType Reason { get; }
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/GroupUpdate.cs b/MediaBrowser.Model/SyncPlay/GroupUpdate.cs
index 8c7208211..6f159d653 100644
--- a/MediaBrowser.Model/SyncPlay/GroupUpdate.cs
+++ b/MediaBrowser.Model/SyncPlay/GroupUpdate.cs
@@ -1,28 +1,42 @@
-#nullable disable
+using System;
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
/// Class GroupUpdate.
/// </summary>
+ /// <typeparam name="T">The type of the data of the message.</typeparam>
public class GroupUpdate<T>
{
/// <summary>
- /// Gets or sets the group identifier.
+ /// Initializes a new instance of the <see cref="GroupUpdate{T}"/> class.
+ /// </summary>
+ /// <param name="groupId">The group identifier.</param>
+ /// <param name="type">The update type.</param>
+ /// <param name="data">The update data.</param>
+ public GroupUpdate(Guid groupId, GroupUpdateType type, T data)
+ {
+ GroupId = groupId;
+ Type = type;
+ Data = data;
+ }
+
+ /// <summary>
+ /// Gets the group identifier.
/// </summary>
/// <value>The group identifier.</value>
- public string GroupId { get; set; }
+ public Guid GroupId { get; }
/// <summary>
- /// Gets or sets the update type.
+ /// Gets the update type.
/// </summary>
/// <value>The update type.</value>
- public GroupUpdateType Type { get; set; }
+ public GroupUpdateType Type { get; }
/// <summary>
- /// Gets or sets the data.
+ /// Gets the update data.
/// </summary>
- /// <value>The data.</value>
- public T Data { get; set; }
+ /// <value>The update data.</value>
+ public T Data { get; }
}
}
diff --git a/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs b/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs
index c749f7b13..907d1defe 100644
--- a/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs
+++ b/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs
@@ -26,14 +26,14 @@ namespace MediaBrowser.Model.SyncPlay
GroupLeft,
/// <summary>
- /// The group-wait update. Tells members of the group that a user is buffering.
+ /// The group-state update. Tells members of the group that the state changed.
/// </summary>
- GroupWait,
+ StateUpdate,
/// <summary>
- /// The prepare-session update. Tells a user to load some content.
+ /// The play-queue update. Tells a user the playing queue of the group.
/// </summary>
- PrepareSession,
+ PlayQueue,
/// <summary>
/// The not-in-group error. Tells a user that they don't belong to a group.
diff --git a/MediaBrowser.Model/SyncPlay/JoinGroupRequest.cs b/MediaBrowser.Model/SyncPlay/JoinGroupRequest.cs
deleted file mode 100644
index 0c77a6132..000000000
--- a/MediaBrowser.Model/SyncPlay/JoinGroupRequest.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-
-namespace MediaBrowser.Model.SyncPlay
-{
- /// <summary>
- /// Class JoinGroupRequest.
- /// </summary>
- public class JoinGroupRequest
- {
- /// <summary>
- /// Gets or sets the Group id.
- /// </summary>
- /// <value>The Group id to join.</value>
- public Guid GroupId { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs b/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs
new file mode 100644
index 000000000..a851229f7
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Class PlayQueueUpdate.
+ /// </summary>
+ public class PlayQueueUpdate
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PlayQueueUpdate"/> class.
+ /// </summary>
+ /// <param name="reason">The reason for the update.</param>
+ /// <param name="lastUpdate">The UTC time of the last change to the playing queue.</param>
+ /// <param name="playlist">The playlist.</param>
+ /// <param name="playingItemIndex">The playing item index in the playlist.</param>
+ /// <param name="startPositionTicks">The start position ticks.</param>
+ /// <param name="shuffleMode">The shuffle mode.</param>
+ /// <param name="repeatMode">The repeat mode.</param>
+ public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<QueueItem> playlist, int playingItemIndex, long startPositionTicks, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode)
+ {
+ Reason = reason;
+ LastUpdate = lastUpdate;
+ Playlist = playlist;
+ PlayingItemIndex = playingItemIndex;
+ StartPositionTicks = startPositionTicks;
+ ShuffleMode = shuffleMode;
+ RepeatMode = repeatMode;
+ }
+
+ /// <summary>
+ /// Gets the request type that originated this update.
+ /// </summary>
+ /// <value>The reason for the update.</value>
+ public PlayQueueUpdateReason Reason { get; }
+
+ /// <summary>
+ /// Gets the UTC time of the last change to the playing queue.
+ /// </summary>
+ /// <value>The UTC time of the last change to the playing queue.</value>
+ public DateTime LastUpdate { get; }
+
+ /// <summary>
+ /// Gets the playlist.
+ /// </summary>
+ /// <value>The playlist.</value>
+ public IReadOnlyList<QueueItem> Playlist { get; }
+
+ /// <summary>
+ /// Gets the playing item index in the playlist.
+ /// </summary>
+ /// <value>The playing item index in the playlist.</value>
+ public int PlayingItemIndex { get; }
+
+ /// <summary>
+ /// Gets the start position ticks.
+ /// </summary>
+ /// <value>The start position ticks.</value>
+ public long StartPositionTicks { get; }
+
+ /// <summary>
+ /// Gets the shuffle mode.
+ /// </summary>
+ /// <value>The shuffle mode.</value>
+ public GroupShuffleMode ShuffleMode { get; }
+
+ /// <summary>
+ /// Gets the repeat mode.
+ /// </summary>
+ /// <value>The repeat mode.</value>
+ public GroupRepeatMode RepeatMode { get; }
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs b/MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs
new file mode 100644
index 000000000..b609f4b1b
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs
@@ -0,0 +1,58 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Enum PlayQueueUpdateReason.
+ /// </summary>
+ public enum PlayQueueUpdateReason
+ {
+ /// <summary>
+ /// A user is requesting to play a new playlist.
+ /// </summary>
+ NewPlaylist = 0,
+
+ /// <summary>
+ /// A user is changing the playing item.
+ /// </summary>
+ SetCurrentItem = 1,
+
+ /// <summary>
+ /// A user is removing items from the playlist.
+ /// </summary>
+ RemoveItems = 2,
+
+ /// <summary>
+ /// A user is moving an item in the playlist.
+ /// </summary>
+ MoveItem = 3,
+
+ /// <summary>
+ /// A user is adding items the queue.
+ /// </summary>
+ Queue = 4,
+
+ /// <summary>
+ /// A user is adding items to the queue, after the currently playing item.
+ /// </summary>
+ QueueNext = 5,
+
+ /// <summary>
+ /// A user is requesting the next item in queue.
+ /// </summary>
+ NextItem = 6,
+
+ /// <summary>
+ /// A user is requesting the previous item in queue.
+ /// </summary>
+ PreviousItem = 7,
+
+ /// <summary>
+ /// A user is changing repeat mode.
+ /// </summary>
+ RepeatMode = 8,
+
+ /// <summary>
+ /// A user is changing shuffle mode.
+ /// </summary>
+ ShuffleMode = 9
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/PlaybackRequest.cs b/MediaBrowser.Model/SyncPlay/PlaybackRequest.cs
deleted file mode 100644
index 9de23194e..000000000
--- a/MediaBrowser.Model/SyncPlay/PlaybackRequest.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-
-namespace MediaBrowser.Model.SyncPlay
-{
- /// <summary>
- /// Class PlaybackRequest.
- /// </summary>
- public class PlaybackRequest
- {
- /// <summary>
- /// Gets or sets the request type.
- /// </summary>
- /// <value>The request type.</value>
- public PlaybackRequestType Type { get; set; }
-
- /// <summary>
- /// Gets or sets when the request has been made by the client.
- /// </summary>
- /// <value>The date of the request.</value>
- public DateTime? When { get; set; }
-
- /// <summary>
- /// Gets or sets the position ticks.
- /// </summary>
- /// <value>The position ticks.</value>
- public long? PositionTicks { get; set; }
-
- /// <summary>
- /// Gets or sets the ping time.
- /// </summary>
- /// <value>The ping time.</value>
- public long? Ping { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/SyncPlay/PlaybackRequestType.cs b/MediaBrowser.Model/SyncPlay/PlaybackRequestType.cs
index e89efeed8..4429623dd 100644
--- a/MediaBrowser.Model/SyncPlay/PlaybackRequestType.cs
+++ b/MediaBrowser.Model/SyncPlay/PlaybackRequestType.cs
@@ -6,33 +6,88 @@ namespace MediaBrowser.Model.SyncPlay
public enum PlaybackRequestType
{
/// <summary>
- /// A user is requesting a play command for the group.
+ /// A user is setting a new playlist.
/// </summary>
Play = 0,
/// <summary>
+ /// A user is changing the playlist item.
+ /// </summary>
+ SetPlaylistItem = 1,
+
+ /// <summary>
+ /// A user is removing items from the playlist.
+ /// </summary>
+ RemoveFromPlaylist = 2,
+
+ /// <summary>
+ /// A user is moving an item in the playlist.
+ /// </summary>
+ MovePlaylistItem = 3,
+
+ /// <summary>
+ /// A user is adding items to the playlist.
+ /// </summary>
+ Queue = 4,
+
+ /// <summary>
+ /// A user is requesting an unpause command for the group.
+ /// </summary>
+ Unpause = 5,
+
+ /// <summary>
/// A user is requesting a pause command for the group.
/// </summary>
- Pause = 1,
+ Pause = 6,
/// <summary>
- /// A user is requesting a seek command for the group.
+ /// A user is requesting a stop command for the group.
/// </summary>
- Seek = 2,
+ Stop = 7,
/// <summary>
+ /// A user is requesting a seek command for the group.
+ /// </summary>
+ Seek = 8,
+
+ /// <summary>
/// A user is signaling that playback is buffering.
/// </summary>
- Buffer = 3,
+ Buffer = 9,
/// <summary>
/// A user is signaling that playback resumed.
/// </summary>
- Ready = 4,
+ Ready = 10,
+
+ /// <summary>
+ /// A user is requesting next item in playlist.
+ /// </summary>
+ NextItem = 11,
+
+ /// <summary>
+ /// A user is requesting previous item in playlist.
+ /// </summary>
+ PreviousItem = 12,
+
+ /// <summary>
+ /// A user is setting the repeat mode.
+ /// </summary>
+ SetRepeatMode = 13,
+
+ /// <summary>
+ /// A user is setting the shuffle mode.
+ /// </summary>
+ SetShuffleMode = 14,
+
+ /// <summary>
+ /// A user is reporting their ping.
+ /// </summary>
+ Ping = 15,
/// <summary>
- /// A user is reporting its ping.
+ /// A user is requesting to be ignored on group wait.
/// </summary>
- Ping = 5
+ IgnoreWait = 16
}
}
diff --git a/MediaBrowser.Model/SyncPlay/QueueItem.cs b/MediaBrowser.Model/SyncPlay/QueueItem.cs
new file mode 100644
index 000000000..a6dcc109e
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/QueueItem.cs
@@ -0,0 +1,31 @@
+using System;
+
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Class QueueItem.
+ /// </summary>
+ public class QueueItem
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="QueueItem"/> class.
+ /// </summary>
+ /// <param name="itemId">The item identifier.</param>
+ public QueueItem(Guid itemId)
+ {
+ ItemId = itemId;
+ }
+
+ /// <summary>
+ /// Gets the item identifier.
+ /// </summary>
+ /// <value>The item identifier.</value>
+ public Guid ItemId { get; }
+
+ /// <summary>
+ /// Gets the playlist identifier of the item.
+ /// </summary>
+ /// <value>The playlist identifier of the item.</value>
+ public Guid PlaylistItemId { get; } = Guid.NewGuid();
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/RequestType.cs b/MediaBrowser.Model/SyncPlay/RequestType.cs
new file mode 100644
index 000000000..a6e397dcd
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/RequestType.cs
@@ -0,0 +1,33 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Enum RequestType.
+ /// </summary>
+ public enum RequestType
+ {
+ /// <summary>
+ /// A user is requesting to create a new group.
+ /// </summary>
+ NewGroup = 0,
+
+ /// <summary>
+ /// A user is requesting to join a group.
+ /// </summary>
+ JoinGroup = 1,
+
+ /// <summary>
+ /// A user is requesting to leave a group.
+ /// </summary>
+ LeaveGroup = 2,
+
+ /// <summary>
+ /// A user is requesting the list of available groups.
+ /// </summary>
+ ListGroups = 3,
+
+ /// <summary>
+ /// A user is sending a playback command to a group.
+ /// </summary>
+ Playback = 4
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/SendCommand.cs b/MediaBrowser.Model/SyncPlay/SendCommand.cs
index 0f0be0152..73cb50876 100644
--- a/MediaBrowser.Model/SyncPlay/SendCommand.cs
+++ b/MediaBrowser.Model/SyncPlay/SendCommand.cs
@@ -1,4 +1,4 @@
-#nullable disable
+using System;
namespace MediaBrowser.Model.SyncPlay
{
@@ -8,33 +8,58 @@ namespace MediaBrowser.Model.SyncPlay
public class SendCommand
{
/// <summary>
- /// Gets or sets the group identifier.
+ /// Initializes a new instance of the <see cref="SendCommand"/> class.
+ /// </summary>
+ /// <param name="groupId">The group identifier.</param>
+ /// <param name="playlistItemId">The playlist identifier of the playing item.</param>
+ /// <param name="when">The UTC time when to execute the command.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="positionTicks">The position ticks, for commands that require it.</param>
+ /// <param name="emittedAt">The UTC time when this command has been emitted.</param>
+ public SendCommand(Guid groupId, Guid playlistItemId, DateTime when, SendCommandType command, long? positionTicks, DateTime emittedAt)
+ {
+ GroupId = groupId;
+ PlaylistItemId = playlistItemId;
+ When = when;
+ Command = command;
+ PositionTicks = positionTicks;
+ EmittedAt = emittedAt;
+ }
+
+ /// <summary>
+ /// Gets the group identifier.
/// </summary>
/// <value>The group identifier.</value>
- public string GroupId { get; set; }
+ public Guid GroupId { get; }
+
+ /// <summary>
+ /// Gets the playlist identifier of the playing item.
+ /// </summary>
+ /// <value>The playlist identifier of the playing item.</value>
+ public Guid PlaylistItemId { get; }
/// <summary>
/// Gets or sets the UTC time when to execute the command.
/// </summary>
/// <value>The UTC time when to execute the command.</value>
- public string When { get; set; }
+ public DateTime When { get; set; }
/// <summary>
- /// Gets or sets the position ticks.
+ /// Gets the position ticks.
/// </summary>
/// <value>The position ticks.</value>
- public long? PositionTicks { get; set; }
+ public long? PositionTicks { get; }
/// <summary>
- /// Gets or sets the command.
+ /// Gets the command.
/// </summary>
/// <value>The command.</value>
- public SendCommandType Command { get; set; }
+ public SendCommandType Command { get; }
/// <summary>
- /// Gets or sets the UTC time when this command has been emitted.
+ /// Gets the UTC time when this command has been emitted.
/// </summary>
/// <value>The UTC time when this command has been emitted.</value>
- public string EmittedAt { get; set; }
+ public DateTime EmittedAt { get; }
}
}
diff --git a/MediaBrowser.Model/SyncPlay/SendCommandType.cs b/MediaBrowser.Model/SyncPlay/SendCommandType.cs
index 86dec9e90..e6b17c60a 100644
--- a/MediaBrowser.Model/SyncPlay/SendCommandType.cs
+++ b/MediaBrowser.Model/SyncPlay/SendCommandType.cs
@@ -6,9 +6,9 @@ namespace MediaBrowser.Model.SyncPlay
public enum SendCommandType
{
/// <summary>
- /// The play command. Instructs users to start playback.
+ /// The unpause command. Instructs users to unpause playback.
/// </summary>
- Play = 0,
+ Unpause = 0,
/// <summary>
/// The pause command. Instructs users to pause playback.
@@ -16,8 +16,13 @@ namespace MediaBrowser.Model.SyncPlay
Pause = 1,
/// <summary>
+ /// The stop command. Instructs users to stop playback.
+ /// </summary>
+ Stop = 2,
+
+ /// <summary>
/// The seek command. Instructs users to seek to a specified time.
/// </summary>
- Seek = 2
+ Seek = 3
}
}
diff --git a/MediaBrowser.Model/SyncPlay/SyncPlayBroadcastType.cs b/MediaBrowser.Model/SyncPlay/SyncPlayBroadcastType.cs
new file mode 100644
index 000000000..29dbb11b3
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/SyncPlayBroadcastType.cs
@@ -0,0 +1,28 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Used to filter the sessions of a group.
+ /// </summary>
+ public enum SyncPlayBroadcastType
+ {
+ /// <summary>
+ /// All sessions will receive the message.
+ /// </summary>
+ AllGroup = 0,
+
+ /// <summary>
+ /// Only the specified session will receive the message.
+ /// </summary>
+ CurrentSession = 1,
+
+ /// <summary>
+ /// All sessions, except the current one, will receive the message.
+ /// </summary>
+ AllExceptCurrentSession = 2,
+
+ /// <summary>
+ /// Only sessions that are not buffering will receive the message.
+ /// </summary>
+ AllReady = 3
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/UtcTimeResponse.cs b/MediaBrowser.Model/SyncPlay/UtcTimeResponse.cs
index 8ec5eaab3..219e7b1e0 100644
--- a/MediaBrowser.Model/SyncPlay/UtcTimeResponse.cs
+++ b/MediaBrowser.Model/SyncPlay/UtcTimeResponse.cs
@@ -1,4 +1,4 @@
-#nullable disable
+using System;
namespace MediaBrowser.Model.SyncPlay
{
@@ -8,15 +8,26 @@ namespace MediaBrowser.Model.SyncPlay
public class UtcTimeResponse
{
/// <summary>
- /// Gets or sets the UTC time when request has been received.
+ /// Initializes a new instance of the <see cref="UtcTimeResponse"/> class.
+ /// </summary>
+ /// <param name="requestReceptionTime">The UTC time when request has been received.</param>
+ /// <param name="responseTransmissionTime">The UTC time when response has been sent.</param>
+ public UtcTimeResponse(DateTime requestReceptionTime, DateTime responseTransmissionTime)
+ {
+ RequestReceptionTime = requestReceptionTime;
+ ResponseTransmissionTime = responseTransmissionTime;
+ }
+
+ /// <summary>
+ /// Gets the UTC time when request has been received.
/// </summary>
/// <value>The UTC time when request has been received.</value>
- public string RequestReceptionTime { get; set; }
+ public DateTime RequestReceptionTime { get; }
/// <summary>
- /// Gets or sets the UTC time when response has been sent.
+ /// Gets the UTC time when response has been sent.
/// </summary>
/// <value>The UTC time when response has been sent.</value>
- public string ResponseTransmissionTime { get; set; }
+ public DateTime ResponseTransmissionTime { get; }
}
}