diff options
| author | gion <oancaionutandrei@gmail.com> | 2020-05-12 19:05:05 +0200 |
|---|---|---|
| committer | Ionut Andrei Oanca <oancaionutandrei@gmail.com> | 2020-10-16 11:38:50 +0200 |
| commit | e10799e0e8d7afcdf07585ac4b27dd060c973d8f (patch) | |
| tree | 9132965bbc0f06a2298a656f9aab3b87043012e5 /MediaBrowser.Model/SyncPlay | |
| parent | 5487dfc145096faeaa9ee82d92ffa224ef69fc11 (diff) | |
Rewrite syncplay using a state design pattern
Diffstat (limited to 'MediaBrowser.Model/SyncPlay')
| -rw-r--r-- | MediaBrowser.Model/SyncPlay/GroupState.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Model/SyncPlay/PlaybackRequest.cs | 34 | ||||
| -rw-r--r-- | MediaBrowser.Model/SyncPlay/SyncPlayBroadcastType.cs | 28 |
3 files changed, 53 insertions, 34 deletions
diff --git a/MediaBrowser.Model/SyncPlay/GroupState.cs b/MediaBrowser.Model/SyncPlay/GroupState.cs new file mode 100644 index 000000000..871634d55 --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/GroupState.cs @@ -0,0 +1,25 @@ +namespace MediaBrowser.Model.SyncPlay +{ + /// <summary> + /// Enum GroupState. + /// </summary> + public enum GroupState + { + /// <summary> + /// The group is in idle state. No media is playing. + /// </summary> + Idle, + /// <summary> + /// The group is in wating state. Playback is paused. Will start playing when users are ready. + /// </summary> + Waiting, + /// <summary> + /// The group is in paused state. Playback is paused. Will resume on play command. + /// </summary> + Paused, + /// <summary> + /// The group is in playing state. Playback is advancing. + /// </summary> + Playing + } +} 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/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 + } +} |
