Rewrite syncplay using a state design pattern

This commit is contained in:
gion
2020-05-12 19:05:05 +02:00
committed by Ionut Andrei Oanca
parent 5487dfc145
commit e10799e0e8
21 changed files with 934 additions and 429 deletions

View File

@@ -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
}
}

View File

@@ -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; }
}
}

View File

@@ -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
}
}