mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-02 00:12:24 +00:00
keep playstate during syncplay group creation
This commit is contained in:
@@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <summary>
|
||||
/// Gets the default ping value used for sessions.
|
||||
/// </summary>
|
||||
public long DefaulPing { get; } = 500;
|
||||
public long DefaultPing { get; } = 500;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the group identifier.
|
||||
@@ -70,16 +70,16 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <param name="session">The session.</param>
|
||||
public void AddSession(SessionInfo session)
|
||||
{
|
||||
if (ContainsSession(session.Id.ToString()))
|
||||
if (ContainsSession(session.Id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var member = new GroupMember();
|
||||
member.Session = session;
|
||||
member.Ping = DefaulPing;
|
||||
member.Ping = DefaultPing;
|
||||
member.IsBuffering = false;
|
||||
Participants[session.Id.ToString()] = member;
|
||||
Participants[session.Id] = member;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -88,12 +88,12 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <param name="session">The session.</param>
|
||||
public void RemoveSession(SessionInfo session)
|
||||
{
|
||||
if (!ContainsSession(session.Id.ToString()))
|
||||
if (!ContainsSession(session.Id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Participants.Remove(session.Id.ToString(), out _);
|
||||
Participants.Remove(session.Id, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -103,12 +103,12 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <param name="ping">The ping.</param>
|
||||
public void UpdatePing(SessionInfo session, long ping)
|
||||
{
|
||||
if (!ContainsSession(session.Id.ToString()))
|
||||
if (!ContainsSession(session.Id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Participants[session.Id.ToString()].Ping = ping;
|
||||
Participants[session.Id].Ping = ping;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,7 +117,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <value name="session">The highest ping in the group.</value>
|
||||
public long GetHighestPing()
|
||||
{
|
||||
long max = Int64.MinValue;
|
||||
long max = long.MinValue;
|
||||
foreach (var session in Participants.Values)
|
||||
{
|
||||
max = Math.Max(max, session.Ping);
|
||||
@@ -133,12 +133,12 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <param name="isBuffering">The state.</param>
|
||||
public void SetBuffering(SessionInfo session, bool isBuffering)
|
||||
{
|
||||
if (!ContainsSession(session.Id.ToString()))
|
||||
if (!ContainsSession(session.Id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Participants[session.Id.ToString()].IsBuffering = isBuffering;
|
||||
Participants[session.Id].IsBuffering = isBuffering;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
public class GroupMember
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets whether this member is buffering.
|
||||
/// Gets or sets a value indicating whether this member is buffering.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if member is buffering; <c>false</c> otherwise.</value>
|
||||
public bool IsBuffering { get; set; }
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void InitGroup(SessionInfo session, CancellationToken cancellationToken);
|
||||
void CreateGroup(SessionInfo session, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the session to the group.
|
||||
|
||||
Reference in New Issue
Block a user