Refactor and other minor changes

This commit is contained in:
gion 2020-04-21 23:37:37 +02:00
parent aad5058d25
commit 083d3272d0
10 changed files with 410 additions and 269 deletions

View file

@ -176,10 +176,9 @@ namespace Emby.Server.Implementations.HttpServer
{ {
SendKeepAliveResponse(); SendKeepAliveResponse();
} }
else
if (OnReceive != null)
{ {
OnReceive(info); OnReceive?.Invoke(info);
} }
} }
catch (Exception ex) catch (Exception ex)

View file

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Linq; using System.Linq;
@ -25,7 +26,7 @@ namespace Emby.Server.Implementations.Session
public readonly int WebSocketLostTimeout = 60; public readonly int WebSocketLostTimeout = 60;
/// <summary> /// <summary>
/// The timer factor; controls the frequency of the timer. /// The keep-alive timer factor; controls how often the timer will check on the status of the WebSockets.
/// </summary> /// </summary>
public readonly double TimerFactor = 0.2; public readonly double TimerFactor = 0.2;
@ -136,11 +137,10 @@ namespace Emby.Server.Implementations.Session
/// </summary> /// </summary>
/// <param name="sender">The WebSocket.</param> /// <param name="sender">The WebSocket.</param>
/// <param name="e">The event arguments.</param> /// <param name="e">The event arguments.</param>
private void _webSocket_Closed(object sender, EventArgs e) private void OnWebSocketClosed(object sender, EventArgs e)
{ {
var webSocket = (IWebSocketConnection) sender; var webSocket = (IWebSocketConnection) sender;
webSocket.Closed -= _webSocket_Closed; RemoveWebSocket(webSocket);
_webSockets.TryRemove(webSocket, out _);
} }
/// <summary> /// <summary>
@ -149,8 +149,12 @@ namespace Emby.Server.Implementations.Session
/// <param name="webSocket">The WebSocket to monitor.</param> /// <param name="webSocket">The WebSocket to monitor.</param>
private async void KeepAliveWebSocket(IWebSocketConnection webSocket) private async void KeepAliveWebSocket(IWebSocketConnection webSocket)
{ {
_webSockets.TryAdd(webSocket, 0); if (!_webSockets.TryAdd(webSocket, 0))
webSocket.Closed += _webSocket_Closed; {
_logger.LogWarning("Multiple attempts to keep alive single WebSocket {0}", webSocket);
return;
}
webSocket.Closed += OnWebSocketClosed;
webSocket.LastKeepAliveDate = DateTime.UtcNow; webSocket.LastKeepAliveDate = DateTime.UtcNow;
// Notify WebSocket about timeout // Notify WebSocket about timeout
@ -160,12 +164,22 @@ namespace Emby.Server.Implementations.Session
} }
catch (WebSocketException exception) catch (WebSocketException exception)
{ {
_logger.LogDebug(exception, "Error sending ForceKeepAlive message to WebSocket."); _logger.LogWarning(exception, "Error sending ForceKeepAlive message to WebSocket.");
} }
StartKeepAliveTimer(); StartKeepAliveTimer();
} }
/// <summary>
/// Removes a WebSocket from the KeepAlive watchlist.
/// </summary>
/// <param name="webSocket">The WebSocket to remove.</param>
private void RemoveWebSocket(IWebSocketConnection webSocket)
{
webSocket.Closed -= OnWebSocketClosed;
_webSockets.TryRemove(webSocket, out _);
}
/// <summary> /// <summary>
/// Starts the KeepAlive timer. /// Starts the KeepAlive timer.
/// </summary> /// </summary>
@ -195,7 +209,7 @@ namespace Emby.Server.Implementations.Session
foreach (var pair in _webSockets) foreach (var pair in _webSockets)
{ {
pair.Key.Closed -= _webSocket_Closed; pair.Key.Closed -= OnWebSocketClosed;
} }
} }
@ -214,7 +228,7 @@ namespace Emby.Server.Implementations.Session
if (inactive.Any()) if (inactive.Any())
{ {
_logger.LogDebug("Sending ForceKeepAlive message to {0} WebSockets.", inactive.Count()); _logger.LogDebug("Sending ForceKeepAlive message to {0} inactive WebSockets.", inactive.Count());
} }
foreach (var webSocket in inactive) foreach (var webSocket in inactive)
@ -225,15 +239,19 @@ namespace Emby.Server.Implementations.Session
} }
catch (WebSocketException exception) catch (WebSocketException exception)
{ {
_logger.LogDebug(exception, "Error sending ForceKeepAlive message to WebSocket."); _logger.LogInformation(exception, "Error sending ForceKeepAlive message to WebSocket.");
lost.Append(webSocket); lost.Append(webSocket);
} }
} }
if (lost.Any()) if (lost.Any())
{ {
// TODO: handle lost webSockets _logger.LogInformation("Lost {0} WebSockets.", lost.Count());
_logger.LogDebug("Lost {0} WebSockets.", lost.Count()); foreach (var webSocket in lost)
{
// TODO: handle session relative to the lost webSocket
RemoveWebSocket(webSocket);
}
} }
if (!_webSockets.Any()) if (!_webSockets.Any())

View file

@ -16,11 +16,26 @@ namespace Emby.Server.Implementations.Syncplay
/// </summary> /// </summary>
public class SyncplayController : ISyncplayController, IDisposable public class SyncplayController : ISyncplayController, IDisposable
{ {
/// <summary>
/// Used to filter the sessions of a group.
/// </summary>
private enum BroadcastType private enum BroadcastType
{ {
/// <summary>
/// All sessions will receive the message.
/// </summary>
AllGroup = 0, AllGroup = 0,
SingleSession = 1, /// <summary>
AllExceptSession = 2, /// 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 AllReady = 3
} }
@ -95,40 +110,46 @@ namespace Emby.Server.Implementations.Syncplay
} }
} }
/// <summary>
/// Filters sessions of this group.
/// </summary>
/// <param name="from">The current session.</param>
/// <param name="type">The filtering type.</param>
/// <value>The array of sessions matching the filter.</value>
private SessionInfo[] FilterSessions(SessionInfo from, BroadcastType type) private SessionInfo[] FilterSessions(SessionInfo from, BroadcastType type)
{ {
if (type == BroadcastType.SingleSession) switch (type)
{ {
return new SessionInfo[] { from }; case BroadcastType.CurrentSession:
} return new SessionInfo[] { from };
else if (type == BroadcastType.AllGroup) case BroadcastType.AllGroup:
{ return _group.Participants.Values.Select(
return _group.Partecipants.Values.Select( session => session.Session
session => session.Session ).ToArray();
).ToArray(); case BroadcastType.AllExceptCurrentSession:
} return _group.Participants.Values.Select(
else if (type == BroadcastType.AllExceptSession) session => session.Session
{ ).Where(
return _group.Partecipants.Values.Select( session => !session.Id.Equals(from.Id)
session => session.Session ).ToArray();
).Where( case BroadcastType.AllReady:
session => !session.Id.Equals(from.Id) return _group.Participants.Values.Where(
).ToArray(); session => !session.IsBuffering
} ).Select(
else if (type == BroadcastType.AllReady) session => session.Session
{ ).ToArray();
return _group.Partecipants.Values.Where( default:
session => !session.IsBuffering return new SessionInfo[] { };
).Select(
session => session.Session
).ToArray();
}
else
{
return new SessionInfo[] {};
} }
} }
/// <summary>
/// Sends a GroupUpdate message to the interested sessions.
/// </summary>
/// <param name="from">The current session.</param>
/// <param name="type">The filtering type.</param>
/// <param name="message">The message to send.</param>
/// <value>The task.</value>
private Task SendGroupUpdate<T>(SessionInfo from, BroadcastType type, GroupUpdate<T> message) private Task SendGroupUpdate<T>(SessionInfo from, BroadcastType type, GroupUpdate<T> message)
{ {
IEnumerable<Task> GetTasks() IEnumerable<Task> GetTasks()
@ -143,6 +164,13 @@ namespace Emby.Server.Implementations.Syncplay
return Task.WhenAll(GetTasks()); return Task.WhenAll(GetTasks());
} }
/// <summary>
/// Sends a playback command to the interested sessions.
/// </summary>
/// <param name="from">The current session.</param>
/// <param name="type">The filtering type.</param>
/// <param name="message">The message to send.</param>
/// <value>The task.</value>
private Task SendCommand(SessionInfo from, BroadcastType type, SendCommand message) private Task SendCommand(SessionInfo from, BroadcastType type, SendCommand message)
{ {
IEnumerable<Task> GetTasks() IEnumerable<Task> GetTasks()
@ -157,31 +185,44 @@ namespace Emby.Server.Implementations.Syncplay
return Task.WhenAll(GetTasks()); return Task.WhenAll(GetTasks());
} }
/// <summary>
/// Builds a new playback command with some default values.
/// </summary>
/// <param name="type">The command type.</param>
/// <value>The SendCommand.</value>
private SendCommand NewSyncplayCommand(SendCommandType type) private SendCommand NewSyncplayCommand(SendCommandType type)
{ {
var command = new SendCommand(); return new SendCommand()
command.GroupId = _group.GroupId.ToString(); {
command.Command = type; GroupId = _group.GroupId.ToString(),
command.PositionTicks = _group.PositionTicks; Command = type,
command.When = _group.LastActivity.ToUniversalTime().ToString("o"); PositionTicks = _group.PositionTicks,
command.EmittedAt = DateTime.UtcNow.ToUniversalTime().ToString("o"); When = _group.LastActivity.ToUniversalTime().ToString("o"),
return command; EmittedAt = DateTime.UtcNow.ToUniversalTime().ToString("o")
};
} }
/// <summary>
/// Builds a new group update message.
/// </summary>
/// <param name="type">The update type.</param>
/// <param name="data">The data to send.</param>
/// <value>The GroupUpdate.</value>
private GroupUpdate<T> NewSyncplayGroupUpdate<T>(GroupUpdateType type, T data) private GroupUpdate<T> NewSyncplayGroupUpdate<T>(GroupUpdateType type, T data)
{ {
var command = new GroupUpdate<T>(); return new GroupUpdate<T>()
command.GroupId = _group.GroupId.ToString(); {
command.Type = type; GroupId = _group.GroupId.ToString(),
command.Data = data; Type = type,
return command; Data = data
};
} }
/// <inheritdoc /> /// <inheritdoc />
public void InitGroup(SessionInfo session) public void InitGroup(SessionInfo session)
{ {
_group.AddSession(session); _group.AddSession(session);
_syncplayManager.MapSessionToGroup(session, this); _syncplayManager.AddSessionToGroup(session, this);
_group.PlayingItem = session.FullNowPlayingItem; _group.PlayingItem = session.FullNowPlayingItem;
_group.IsPaused = true; _group.IsPaused = true;
@ -189,37 +230,35 @@ namespace Emby.Server.Implementations.Syncplay
_group.LastActivity = DateTime.UtcNow; _group.LastActivity = DateTime.UtcNow;
var updateSession = NewSyncplayGroupUpdate(GroupUpdateType.GroupJoined, DateTime.UtcNow.ToUniversalTime().ToString("o")); var updateSession = NewSyncplayGroupUpdate(GroupUpdateType.GroupJoined, DateTime.UtcNow.ToUniversalTime().ToString("o"));
SendGroupUpdate(session, BroadcastType.SingleSession, updateSession); SendGroupUpdate(session, BroadcastType.CurrentSession, updateSession);
var pauseCommand = NewSyncplayCommand(SendCommandType.Pause); var pauseCommand = NewSyncplayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.SingleSession, pauseCommand); SendCommand(session, BroadcastType.CurrentSession, pauseCommand);
} }
/// <inheritdoc /> /// <inheritdoc />
public void SessionJoin(SessionInfo session, JoinGroupRequest request) public void SessionJoin(SessionInfo session, JoinGroupRequest request)
{ {
if (session.NowPlayingItem != null && if (session.NowPlayingItem?.Id == _group.PlayingItem.Id && request.PlayingItemId == _group.PlayingItem.Id)
session.NowPlayingItem.Id.Equals(_group.PlayingItem.Id) &&
request.PlayingItemId.Equals(_group.PlayingItem.Id))
{ {
_group.AddSession(session); _group.AddSession(session);
_syncplayManager.MapSessionToGroup(session, this); _syncplayManager.AddSessionToGroup(session, this);
var updateSession = NewSyncplayGroupUpdate(GroupUpdateType.GroupJoined, DateTime.UtcNow.ToUniversalTime().ToString("o")); var updateSession = NewSyncplayGroupUpdate(GroupUpdateType.GroupJoined, DateTime.UtcNow.ToUniversalTime().ToString("o"));
SendGroupUpdate(session, BroadcastType.SingleSession, updateSession); SendGroupUpdate(session, BroadcastType.CurrentSession, updateSession);
var updateOthers = NewSyncplayGroupUpdate(GroupUpdateType.UserJoined, session.UserName); var updateOthers = NewSyncplayGroupUpdate(GroupUpdateType.UserJoined, session.UserName);
SendGroupUpdate(session, BroadcastType.AllExceptSession, updateOthers); SendGroupUpdate(session, BroadcastType.AllExceptCurrentSession, updateOthers);
// Client join and play, syncing will happen client side // Client join and play, syncing will happen client side
if (!_group.IsPaused) if (!_group.IsPaused)
{ {
var playCommand = NewSyncplayCommand(SendCommandType.Play); var playCommand = NewSyncplayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.SingleSession, playCommand); SendCommand(session, BroadcastType.CurrentSession, playCommand);
} }
else else
{ {
var pauseCommand = NewSyncplayCommand(SendCommandType.Pause); var pauseCommand = NewSyncplayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.SingleSession, pauseCommand); SendCommand(session, BroadcastType.CurrentSession, pauseCommand);
} }
} }
else else
@ -228,7 +267,7 @@ namespace Emby.Server.Implementations.Syncplay
playRequest.ItemIds = new Guid[] { _group.PlayingItem.Id }; playRequest.ItemIds = new Guid[] { _group.PlayingItem.Id };
playRequest.StartPositionTicks = _group.PositionTicks; playRequest.StartPositionTicks = _group.PositionTicks;
var update = NewSyncplayGroupUpdate(GroupUpdateType.PrepareSession, playRequest); var update = NewSyncplayGroupUpdate(GroupUpdateType.PrepareSession, playRequest);
SendGroupUpdate(session, BroadcastType.SingleSession, update); SendGroupUpdate(session, BroadcastType.CurrentSession, update);
} }
} }
@ -236,182 +275,250 @@ namespace Emby.Server.Implementations.Syncplay
public void SessionLeave(SessionInfo session) public void SessionLeave(SessionInfo session)
{ {
_group.RemoveSession(session); _group.RemoveSession(session);
_syncplayManager.UnmapSessionFromGroup(session, this); _syncplayManager.RemoveSessionFromGroup(session, this);
var updateSession = NewSyncplayGroupUpdate(GroupUpdateType.GroupLeft, _group.PositionTicks); var updateSession = NewSyncplayGroupUpdate(GroupUpdateType.GroupLeft, _group.PositionTicks);
SendGroupUpdate(session, BroadcastType.SingleSession, updateSession); SendGroupUpdate(session, BroadcastType.CurrentSession, updateSession);
var updateOthers = NewSyncplayGroupUpdate(GroupUpdateType.UserLeft, session.UserName); var updateOthers = NewSyncplayGroupUpdate(GroupUpdateType.UserLeft, session.UserName);
SendGroupUpdate(session, BroadcastType.AllExceptSession, updateOthers); SendGroupUpdate(session, BroadcastType.AllExceptCurrentSession, updateOthers);
} }
/// <inheritdoc /> /// <inheritdoc />
public void HandleRequest(SessionInfo session, PlaybackRequest request) public void HandleRequest(SessionInfo session, PlaybackRequest request)
{ {
if (request.Type.Equals(PlaybackRequestType.Play)) // The server's job is to mantain a consistent state to which clients refer to,
// as also to notify clients of state changes.
// The actual syncing of media playback happens client side.
// Clients are aware of the server's time and use it to sync.
switch (request.Type)
{ {
if (_group.IsPaused) case PlaybackRequestType.Play:
{ HandlePlayRequest(session, request);
var delay = _group.GetHighestPing() * 2; break;
delay = delay < _group.DefaulPing ? _group.DefaulPing : delay; case PlaybackRequestType.Pause:
HandlePauseRequest(session, request);
_group.IsPaused = false; break;
_group.LastActivity = DateTime.UtcNow.AddMilliseconds( case PlaybackRequestType.Seek:
delay HandleSeekRequest(session, request);
); break;
case PlaybackRequestType.Buffering:
var command = NewSyncplayCommand(SendCommandType.Play); HandleBufferingRequest(session, request);
SendCommand(session, BroadcastType.AllGroup, command); break;
} case PlaybackRequestType.BufferingDone:
else HandleBufferingDoneRequest(session, request);
{ break;
// Client got lost case PlaybackRequestType.UpdatePing:
var command = NewSyncplayCommand(SendCommandType.Play); HandlePingUpdateRequest(session, request);
SendCommand(session, BroadcastType.SingleSession, command); break;
}
} }
else if (request.Type.Equals(PlaybackRequestType.Pause)) }
/// <summary>
/// Handles a play action requested by a session.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="request">The play action.</param>
private void HandlePlayRequest(SessionInfo session, PlaybackRequest request)
{
if (_group.IsPaused)
{ {
if (!_group.IsPaused) // Pick a suitable time that accounts for latency
{ var delay = _group.GetHighestPing() * 2;
_group.IsPaused = true; delay = delay < _group.DefaulPing ? _group.DefaulPing : delay;
var currentTime = DateTime.UtcNow;
var elapsedTime = currentTime - _group.LastActivity;
_group.LastActivity = currentTime;
_group.PositionTicks += elapsedTime.Ticks > 0 ? elapsedTime.Ticks : 0;
var command = NewSyncplayCommand(SendCommandType.Pause); // Unpause group and set starting point in future
SendCommand(session, BroadcastType.AllGroup, command); // Clients will start playback at LastActivity (datetime) from PositionTicks (playback position)
} // The added delay does not guarantee, of course, that the command will be received in time
else // Playback synchronization will mainly happen client side
{ _group.IsPaused = false;
var command = NewSyncplayCommand(SendCommandType.Pause); _group.LastActivity = DateTime.UtcNow.AddMilliseconds(
SendCommand(session, BroadcastType.SingleSession, command); delay
} );
}
else if (request.Type.Equals(PlaybackRequestType.Seek))
{
// Sanitize PositionTicks
var ticks = request.PositionTicks ??= 0;
ticks = ticks >= 0 ? ticks : 0;
if (_group.PlayingItem.RunTimeTicks != null)
{
var runTimeTicks = _group.PlayingItem.RunTimeTicks ??= 0;
ticks = ticks > runTimeTicks ? runTimeTicks : ticks;
}
_group.IsPaused = true; var command = NewSyncplayCommand(SendCommandType.Play);
_group.PositionTicks = ticks;
_group.LastActivity = DateTime.UtcNow;
var command = NewSyncplayCommand(SendCommandType.Seek);
SendCommand(session, BroadcastType.AllGroup, command); SendCommand(session, BroadcastType.AllGroup, command);
} }
// TODO: client does not implement this yet else
else if (request.Type.Equals(PlaybackRequestType.Buffering))
{ {
if (!_group.IsPaused) // Client got lost, sending current state
var command = NewSyncplayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.CurrentSession, command);
}
}
/// <summary>
/// Handles a pause action requested by a session.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="request">The pause action.</param>
private void HandlePauseRequest(SessionInfo session, PlaybackRequest request)
{
if (!_group.IsPaused)
{
// Pause group and compute the media playback position
_group.IsPaused = true;
var currentTime = DateTime.UtcNow;
var elapsedTime = currentTime - _group.LastActivity;
_group.LastActivity = currentTime;
// Seek only if playback actually started
// (a pause request may be issued during the delay added to account for latency)
_group.PositionTicks += elapsedTime.Ticks > 0 ? elapsedTime.Ticks : 0;
var command = NewSyncplayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.AllGroup, command);
}
else
{
// Client got lost, sending current state
var command = NewSyncplayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.CurrentSession, command);
}
}
/// <summary>
/// Handles a seek action requested by a session.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="request">The seek action.</param>
private void HandleSeekRequest(SessionInfo session, PlaybackRequest request)
{
// Sanitize PositionTicks
var ticks = request.PositionTicks ??= 0;
ticks = ticks >= 0 ? ticks : 0;
if (_group.PlayingItem.RunTimeTicks != null)
{
var runTimeTicks = _group.PlayingItem.RunTimeTicks ??= 0;
ticks = ticks > runTimeTicks ? runTimeTicks : ticks;
}
// Pause and seek
_group.IsPaused = true;
_group.PositionTicks = ticks;
_group.LastActivity = DateTime.UtcNow;
var command = NewSyncplayCommand(SendCommandType.Seek);
SendCommand(session, BroadcastType.AllGroup, command);
}
/// <summary>
/// Handles a buffering action requested by a session.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="request">The buffering action.</param>
private void HandleBufferingRequest(SessionInfo session, PlaybackRequest request)
{
if (!_group.IsPaused)
{
// Pause group and compute the media playback position
_group.IsPaused = true;
var currentTime = DateTime.UtcNow;
var elapsedTime = currentTime - _group.LastActivity;
_group.LastActivity = currentTime;
_group.PositionTicks += elapsedTime.Ticks > 0 ? elapsedTime.Ticks : 0;
_group.SetBuffering(session, true);
// Send pause command to all non-buffering sessions
var command = NewSyncplayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.AllReady, command);
var updateOthers = NewSyncplayGroupUpdate(GroupUpdateType.GroupWait, session.UserName);
SendGroupUpdate(session, BroadcastType.AllExceptCurrentSession, updateOthers);
}
else
{
// Client got lost, sending current state
var command = NewSyncplayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.CurrentSession, command);
}
}
/// <summary>
/// Handles a buffering-done action requested by a session.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="request">The buffering-done action.</param>
private void HandleBufferingDoneRequest(SessionInfo session, PlaybackRequest request)
{
if (_group.IsPaused)
{
_group.SetBuffering(session, false);
var when = request.When ??= DateTime.UtcNow;
var currentTime = DateTime.UtcNow;
var elapsedTime = currentTime - when;
var clientPosition = TimeSpan.FromTicks(request.PositionTicks ??= 0) + elapsedTime;
var delay = _group.PositionTicks - clientPosition.Ticks;
if (_group.IsBuffering())
{ {
_group.IsPaused = true; // Others are buffering, tell this client to pause when ready
var currentTime = DateTime.UtcNow;
var elapsedTime = currentTime - _group.LastActivity;
_group.LastActivity = currentTime;
_group.PositionTicks += elapsedTime.Ticks > 0 ? elapsedTime.Ticks : 0;
_group.SetBuffering(session, true);
// Send pause command to all non-buffering sessions
var command = NewSyncplayCommand(SendCommandType.Pause); var command = NewSyncplayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.AllReady, command); command.When = currentTime.AddMilliseconds(
delay
var updateOthers = NewSyncplayGroupUpdate(GroupUpdateType.GroupWait, session.UserName); ).ToUniversalTime().ToString("o");
SendGroupUpdate(session, BroadcastType.AllExceptSession, updateOthers); SendCommand(session, BroadcastType.CurrentSession, command);
} }
else else
{ {
var command = NewSyncplayCommand(SendCommandType.Pause); // Let other clients resume as soon as the buffering client catches up
SendCommand(session, BroadcastType.SingleSession, command); _group.IsPaused = false;
}
}
// TODO: client does not implement this yet
else if (request.Type.Equals(PlaybackRequestType.BufferingComplete))
{
if (_group.IsPaused)
{
_group.SetBuffering(session, false);
if (_group.IsBuffering()) { if (delay > _group.GetHighestPing() * 2)
// Others are buffering, tell this client to pause when ready {
var when = request.When ??= DateTime.UtcNow; // Client that was buffering is recovering, notifying others to resume
var currentTime = DateTime.UtcNow; _group.LastActivity = currentTime.AddMilliseconds(
var elapsedTime = currentTime - when;
var clientPosition = TimeSpan.FromTicks(request.PositionTicks ??= 0) + elapsedTime;
var delay = _group.PositionTicks - clientPosition.Ticks;
var command = NewSyncplayCommand(SendCommandType.Pause);
command.When = currentTime.AddMilliseconds(
delay delay
).ToUniversalTime().ToString("o"); );
SendCommand(session, BroadcastType.SingleSession, command); var command = NewSyncplayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.AllExceptCurrentSession, command);
} }
else else
{ {
// Let other clients resume as soon as the buffering client catches up // Client, that was buffering, resumed playback but did not update others in time
var when = request.When ??= DateTime.UtcNow; delay = _group.GetHighestPing() * 2;
var currentTime = DateTime.UtcNow; delay = delay < _group.DefaulPing ? _group.DefaulPing : delay;
var elapsedTime = currentTime - when;
var clientPosition = TimeSpan.FromTicks(request.PositionTicks ??= 0) + elapsedTime;
var delay = _group.PositionTicks - clientPosition.Ticks;
_group.IsPaused = false; _group.LastActivity = currentTime.AddMilliseconds(
delay
);
if (delay > _group.GetHighestPing() * 2) var command = NewSyncplayCommand(SendCommandType.Play);
{ SendCommand(session, BroadcastType.AllGroup, command);
// Client that was buffering is recovering, notifying others to resume }
_group.LastActivity = currentTime.AddMilliseconds(
delay
);
var command = NewSyncplayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.AllExceptSession, command);
}
else
{
// Client, that was buffering, resumed playback but did not update others in time
delay = _group.GetHighestPing() * 2;
delay = delay < _group.DefaulPing ? _group.DefaulPing : delay;
_group.LastActivity = currentTime.AddMilliseconds(
delay
);
var command = NewSyncplayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.AllGroup, command);
}
}
}
else
{
// Make sure client has latest group state
var command = NewSyncplayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.SingleSession, command);
} }
} }
else if (request.Type.Equals(PlaybackRequestType.UpdatePing)) else
{ {
_group.UpdatePing(session, request.Ping ??= _group.DefaulPing); // Group was not waiting, make sure client has latest state
var command = NewSyncplayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.CurrentSession, command);
} }
} }
/// <summary>
/// Updates ping of a session.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="request">The update.</param>
private void HandlePingUpdateRequest(SessionInfo session, PlaybackRequest request)
{
// Collected pings are used to account for network latency when unpausing playback
_group.UpdatePing(session, request.Ping ??= _group.DefaulPing);
}
/// <inheritdoc /> /// <inheritdoc />
public GroupInfoView GetInfo() public GroupInfoView GetInfo()
{ {
var info = new GroupInfoView(); return new GroupInfoView()
info.GroupId = GetGroupId().ToString(); {
info.PlayingItemName = _group.PlayingItem.Name; GroupId = GetGroupId().ToString(),
info.PlayingItemId = _group.PlayingItem.Id.ToString(); PlayingItemName = _group.PlayingItem.Name,
info.PositionTicks = _group.PositionTicks; PlayingItemId = _group.PlayingItem.Id.ToString(),
info.Partecipants = _group.Partecipants.Values.Select(session => session.Session.UserName).ToArray(); PositionTicks = _group.PositionTicks,
return info; Participants = _group.Participants.Values.Select(session => session.Session.UserName).ToArray()
};
} }
} }
} }

View file

@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.Syncplay
/// The groups. /// The groups.
/// </summary> /// </summary>
private readonly ConcurrentDictionary<string, ISyncplayController> _groups = private readonly ConcurrentDictionary<string, ISyncplayController> _groups =
new ConcurrentDictionary<string, ISyncplayController>(StringComparer.OrdinalIgnoreCase); new ConcurrentDictionary<string, ISyncplayController>(StringComparer.OrdinalIgnoreCase);
private bool _disposed = false; private bool _disposed = false;
@ -64,8 +64,8 @@ namespace Emby.Server.Implementations.Syncplay
_sessionManager = sessionManager; _sessionManager = sessionManager;
_libraryManager = libraryManager; _libraryManager = libraryManager;
_sessionManager.SessionEnded += _sessionManager_SessionEnded; _sessionManager.SessionEnded += OnSessionManagerSessionEnded;
_sessionManager.PlaybackStopped += _sessionManager_PlaybackStopped; _sessionManager.PlaybackStopped += OnSessionManagerPlaybackStopped;
} }
/// <summary> /// <summary>
@ -92,8 +92,8 @@ namespace Emby.Server.Implementations.Syncplay
return; return;
} }
_sessionManager.SessionEnded -= _sessionManager_SessionEnded; _sessionManager.SessionEnded -= OnSessionManagerSessionEnded;
_sessionManager.PlaybackStopped -= _sessionManager_PlaybackStopped; _sessionManager.PlaybackStopped -= OnSessionManagerPlaybackStopped;
_disposed = true; _disposed = true;
} }
@ -106,14 +106,14 @@ namespace Emby.Server.Implementations.Syncplay
} }
} }
void _sessionManager_SessionEnded(object sender, SessionEventArgs e) private void OnSessionManagerSessionEnded(object sender, SessionEventArgs e)
{ {
var session = e.SessionInfo; var session = e.SessionInfo;
if (!IsSessionInGroup(session)) return; if (!IsSessionInGroup(session)) return;
LeaveGroup(session); LeaveGroup(session);
} }
void _sessionManager_PlaybackStopped(object sender, PlaybackStopEventArgs e) private void OnSessionManagerPlaybackStopped(object sender, PlaybackStopEventArgs e)
{ {
var session = e.Session; var session = e.Session;
if (!IsSessionInGroup(session)) return; if (!IsSessionInGroup(session)) return;
@ -130,13 +130,13 @@ namespace Emby.Server.Implementations.Syncplay
var item = _libraryManager.GetItemById(itemId); var item = _libraryManager.GetItemById(itemId);
var hasParentalRatingAccess = user.Policy.MaxParentalRating.HasValue ? item.InheritedParentalRatingValue <= user.Policy.MaxParentalRating : true; var hasParentalRatingAccess = user.Policy.MaxParentalRating.HasValue ? item.InheritedParentalRatingValue <= user.Policy.MaxParentalRating : true;
if (!user.Policy.EnableAllFolders) if (!user.Policy.EnableAllFolders && hasParentalRatingAccess)
{ {
var collections = _libraryManager.GetCollectionFolders(item).Select( var collections = _libraryManager.GetCollectionFolders(item).Select(
folder => folder.Id.ToString("N", CultureInfo.InvariantCulture) folder => folder.Id.ToString("N", CultureInfo.InvariantCulture)
); );
var intersect = collections.Intersect(user.Policy.EnabledFolders); var intersect = collections.Intersect(user.Policy.EnabledFolders);
return intersect.Count() > 0 && hasParentalRatingAccess; return intersect.Count() > 0;
} }
else else
{ {
@ -165,7 +165,7 @@ namespace Emby.Server.Implementations.Syncplay
if (user.Policy.SyncplayAccess != SyncplayAccess.CreateAndJoinGroups) if (user.Policy.SyncplayAccess != SyncplayAccess.CreateAndJoinGroups)
{ {
// TODO: shall an error message be sent back to the client? // TODO: report the error to the client
throw new ArgumentException("User does not have permission to create groups"); throw new ArgumentException("User does not have permission to create groups");
} }
@ -187,22 +187,16 @@ namespace Emby.Server.Implementations.Syncplay
if (user.Policy.SyncplayAccess == SyncplayAccess.None) if (user.Policy.SyncplayAccess == SyncplayAccess.None)
{ {
// TODO: shall an error message be sent back to the client? // TODO: report the error to the client
throw new ArgumentException("User does not have access to syncplay"); throw new ArgumentException("User does not have access to syncplay");
} }
if (IsSessionInGroup(session))
{
if (GetSessionGroup(session).Equals(groupId)) return;
LeaveGroup(session);
}
ISyncplayController group; ISyncplayController group;
_groups.TryGetValue(groupId, out group); _groups.TryGetValue(groupId, out group);
if (group == null) if (group == null)
{ {
_logger.LogError("Syncplaymanager JoinGroup: " + groupId + " does not exist."); _logger.LogWarning("Syncplaymanager JoinGroup: {0} does not exist.", groupId);
var update = new GroupUpdate<string>(); var update = new GroupUpdate<string>();
update.Type = GroupUpdateType.NotInGroup; update.Type = GroupUpdateType.NotInGroup;
@ -215,20 +209,26 @@ namespace Emby.Server.Implementations.Syncplay
throw new ArgumentException("User does not have access to playing item"); throw new ArgumentException("User does not have access to playing item");
} }
if (IsSessionInGroup(session))
{
if (GetSessionGroup(session).Equals(groupId)) return;
LeaveGroup(session);
}
group.SessionJoin(session, request); group.SessionJoin(session, request);
} }
/// <inheritdoc /> /// <inheritdoc />
public void LeaveGroup(SessionInfo session) public void LeaveGroup(SessionInfo session)
{ {
// TODO: what happens to users that are in a group and get their permissions revoked? // TODO: determine what happens to users that are in a group and get their permissions revoked
ISyncplayController group; ISyncplayController group;
_sessionToGroupMap.TryGetValue(session.Id, out group); _sessionToGroupMap.TryGetValue(session.Id, out group);
if (group == null) if (group == null)
{ {
_logger.LogWarning("Syncplaymanager HandleRequest: " + session.Id + " not in group."); _logger.LogWarning("Syncplaymanager LeaveGroup: {0} does not belong to any group.", session.Id);
var update = new GroupUpdate<string>(); var update = new GroupUpdate<string>();
update.Type = GroupUpdateType.NotInGroup; update.Type = GroupUpdateType.NotInGroup;
@ -257,9 +257,7 @@ namespace Emby.Server.Implementations.Syncplay
if (session.NowPlayingItem != null) if (session.NowPlayingItem != null)
{ {
return _groups.Values.Where( return _groups.Values.Where(
group => HasAccessToItem(user, group.GetPlayingItemId()) group => group.GetPlayingItemId().Equals(session.FullNowPlayingItem.Id) && HasAccessToItem(user, group.GetPlayingItemId())
).Where(
group => group.GetPlayingItemId().Equals(session.FullNowPlayingItem.Id)
).Select( ).Select(
group => group.GetInfo() group => group.GetInfo()
).ToList(); ).ToList();
@ -291,7 +289,7 @@ namespace Emby.Server.Implementations.Syncplay
if (group == null) if (group == null)
{ {
_logger.LogWarning("Syncplaymanager HandleRequest: " + session.Id + " not in group."); _logger.LogWarning("Syncplaymanager HandleRequest: {0} not in a group.", session.Id);
var update = new GroupUpdate<string>(); var update = new GroupUpdate<string>();
update.Type = GroupUpdateType.NotInGroup; update.Type = GroupUpdateType.NotInGroup;
@ -302,7 +300,7 @@ namespace Emby.Server.Implementations.Syncplay
} }
/// <inheritdoc /> /// <inheritdoc />
public void MapSessionToGroup(SessionInfo session, ISyncplayController group) public void AddSessionToGroup(SessionInfo session, ISyncplayController group)
{ {
if (IsSessionInGroup(session)) if (IsSessionInGroup(session))
{ {
@ -312,7 +310,7 @@ namespace Emby.Server.Implementations.Syncplay
} }
/// <inheritdoc /> /// <inheritdoc />
public void UnmapSessionFromGroup(SessionInfo session, ISyncplayController group) public void RemoveSessionFromGroup(SessionInfo session, ISyncplayController group)
{ {
if (!IsSessionInGroup(session)) if (!IsSessionInGroup(session))
{ {

View file

@ -90,12 +90,20 @@ namespace MediaBrowser.Api.Syncplay
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] [ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string SessionId { get; set; } public string SessionId { get; set; }
/// <summary>
/// Gets or sets the date used to pin PositionTicks in time.
/// </summary>
/// <value>The date related to PositionTicks.</value>
[ApiMember(Name = "When", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "When", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
public string When { get; set; } public string When { get; set; }
[ApiMember(Name = "PositionTicks", IsRequired = true, DataType = "long", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "PositionTicks", IsRequired = true, DataType = "long", ParameterType = "query", Verb = "POST")]
public long PositionTicks { get; set; } public long PositionTicks { get; set; }
/// <summary>
/// Gets or sets whether this is a buffering or a buffering-done request.
/// </summary>
/// <value><c>true</c> if buffering is complete; <c>false</c> otherwise.</value>
[ApiMember(Name = "Resume", IsRequired = true, DataType = "bool", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "Resume", IsRequired = true, DataType = "bool", ParameterType = "query", Verb = "POST")]
public bool Resume { get; set; } public bool Resume { get; set; }
} }
@ -162,8 +170,10 @@ namespace MediaBrowser.Api.Syncplay
public void Post(SyncplayJoinGroup request) public void Post(SyncplayJoinGroup request)
{ {
var currentSession = GetSession(_sessionContext); var currentSession = GetSession(_sessionContext);
var joinRequest = new JoinGroupRequest(); var joinRequest = new JoinGroupRequest()
joinRequest.GroupId = Guid.Parse(request.GroupId); {
GroupId = Guid.Parse(request.GroupId)
};
try try
{ {
joinRequest.PlayingItemId = Guid.Parse(request.PlayingItemId); joinRequest.PlayingItemId = Guid.Parse(request.PlayingItemId);
@ -207,8 +217,10 @@ namespace MediaBrowser.Api.Syncplay
public void Post(SyncplayPlayRequest request) public void Post(SyncplayPlayRequest request)
{ {
var currentSession = GetSession(_sessionContext); var currentSession = GetSession(_sessionContext);
var syncplayRequest = new PlaybackRequest(); var syncplayRequest = new PlaybackRequest()
syncplayRequest.Type = PlaybackRequestType.Play; {
Type = PlaybackRequestType.Play
};
_syncplayManager.HandleRequest(currentSession, syncplayRequest); _syncplayManager.HandleRequest(currentSession, syncplayRequest);
} }
@ -219,8 +231,10 @@ namespace MediaBrowser.Api.Syncplay
public void Post(SyncplayPauseRequest request) public void Post(SyncplayPauseRequest request)
{ {
var currentSession = GetSession(_sessionContext); var currentSession = GetSession(_sessionContext);
var syncplayRequest = new PlaybackRequest(); var syncplayRequest = new PlaybackRequest()
syncplayRequest.Type = PlaybackRequestType.Pause; {
Type = PlaybackRequestType.Pause
};
_syncplayManager.HandleRequest(currentSession, syncplayRequest); _syncplayManager.HandleRequest(currentSession, syncplayRequest);
} }
@ -231,9 +245,11 @@ namespace MediaBrowser.Api.Syncplay
public void Post(SyncplaySeekRequest request) public void Post(SyncplaySeekRequest request)
{ {
var currentSession = GetSession(_sessionContext); var currentSession = GetSession(_sessionContext);
var syncplayRequest = new PlaybackRequest(); var syncplayRequest = new PlaybackRequest()
syncplayRequest.Type = PlaybackRequestType.Seek; {
syncplayRequest.PositionTicks = request.PositionTicks; Type = PlaybackRequestType.Seek,
PositionTicks = request.PositionTicks
};
_syncplayManager.HandleRequest(currentSession, syncplayRequest); _syncplayManager.HandleRequest(currentSession, syncplayRequest);
} }
@ -244,10 +260,12 @@ namespace MediaBrowser.Api.Syncplay
public void Post(SyncplayBufferingRequest request) public void Post(SyncplayBufferingRequest request)
{ {
var currentSession = GetSession(_sessionContext); var currentSession = GetSession(_sessionContext);
var syncplayRequest = new PlaybackRequest(); var syncplayRequest = new PlaybackRequest()
syncplayRequest.Type = request.Resume ? PlaybackRequestType.BufferingComplete : PlaybackRequestType.Buffering; {
syncplayRequest.When = DateTime.Parse(request.When); Type = request.Resume ? PlaybackRequestType.BufferingDone : PlaybackRequestType.Buffering,
syncplayRequest.PositionTicks = request.PositionTicks; When = DateTime.Parse(request.When),
PositionTicks = request.PositionTicks
};
_syncplayManager.HandleRequest(currentSession, syncplayRequest); _syncplayManager.HandleRequest(currentSession, syncplayRequest);
} }
@ -258,9 +276,11 @@ namespace MediaBrowser.Api.Syncplay
public void Post(SyncplayUpdatePing request) public void Post(SyncplayUpdatePing request)
{ {
var currentSession = GetSession(_sessionContext); var currentSession = GetSession(_sessionContext);
var syncplayRequest = new PlaybackRequest(); var syncplayRequest = new PlaybackRequest()
syncplayRequest.Type = PlaybackRequestType.UpdatePing; {
syncplayRequest.Ping = Convert.ToInt64(request.Ping); Type = PlaybackRequestType.UpdatePing,
Ping = Convert.ToInt64(request.Ping)
};
_syncplayManager.HandleRequest(currentSession, syncplayRequest); _syncplayManager.HandleRequest(currentSession, syncplayRequest);
} }
} }

View file

@ -54,7 +54,6 @@ namespace MediaBrowser.Api.Syncplay
var response = new UtcTimeResponse(); var response = new UtcTimeResponse();
response.RequestReceptionTime = requestReceptionTime; response.RequestReceptionTime = requestReceptionTime;
var currentSession = GetSession(_sessionContext);
// Important to keep the following two lines at the end // Important to keep the following two lines at the end
var responseTransmissionTime = DateTime.UtcNow.ToUniversalTime().ToString("o"); var responseTransmissionTime = DateTime.UtcNow.ToUniversalTime().ToString("o");

View file

@ -46,11 +46,11 @@ namespace MediaBrowser.Controller.Syncplay
public DateTime LastActivity { get; set; } public DateTime LastActivity { get; set; }
/// <summary> /// <summary>
/// Gets the partecipants. /// Gets the participants.
/// </summary> /// </summary>
/// <value>The partecipants.</value> /// <value>The participants, or members of the group.</value>
public readonly ConcurrentDictionary<string, GroupMember> Partecipants = public readonly ConcurrentDictionary<string, GroupMember> Participants =
new ConcurrentDictionary<string, GroupMember>(StringComparer.OrdinalIgnoreCase); new ConcurrentDictionary<string, GroupMember>(StringComparer.OrdinalIgnoreCase);
/// <summary> /// <summary>
/// Checks if a session is in this group. /// Checks if a session is in this group.
@ -58,7 +58,7 @@ namespace MediaBrowser.Controller.Syncplay
/// <value><c>true</c> if the session is in this group; <c>false</c> otherwise.</value> /// <value><c>true</c> if the session is in this group; <c>false</c> otherwise.</value>
public bool ContainsSession(string sessionId) public bool ContainsSession(string sessionId)
{ {
return Partecipants.ContainsKey(sessionId); return Participants.ContainsKey(sessionId);
} }
/// <summary> /// <summary>
@ -72,7 +72,7 @@ namespace MediaBrowser.Controller.Syncplay
member.Session = session; member.Session = session;
member.Ping = DefaulPing; member.Ping = DefaulPing;
member.IsBuffering = false; member.IsBuffering = false;
Partecipants[session.Id.ToString()] = member; Participants[session.Id.ToString()] = member;
} }
/// <summary> /// <summary>
@ -84,7 +84,7 @@ namespace MediaBrowser.Controller.Syncplay
{ {
if (!ContainsSession(session.Id.ToString())) return; if (!ContainsSession(session.Id.ToString())) return;
GroupMember member; GroupMember member;
Partecipants.Remove(session.Id.ToString(), out member); Participants.Remove(session.Id.ToString(), out member);
} }
/// <summary> /// <summary>
@ -95,7 +95,7 @@ namespace MediaBrowser.Controller.Syncplay
public void UpdatePing(SessionInfo session, long ping) public void UpdatePing(SessionInfo session, long ping)
{ {
if (!ContainsSession(session.Id.ToString())) return; if (!ContainsSession(session.Id.ToString())) return;
Partecipants[session.Id.ToString()].Ping = ping; Participants[session.Id.ToString()].Ping = ping;
} }
/// <summary> /// <summary>
@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Syncplay
public long GetHighestPing() public long GetHighestPing()
{ {
long max = Int64.MinValue; long max = Int64.MinValue;
foreach (var session in Partecipants.Values) foreach (var session in Participants.Values)
{ {
max = Math.Max(max, session.Ping); max = Math.Max(max, session.Ping);
} }
@ -120,7 +120,7 @@ namespace MediaBrowser.Controller.Syncplay
public void SetBuffering(SessionInfo session, bool isBuffering) public void SetBuffering(SessionInfo session, bool isBuffering)
{ {
if (!ContainsSession(session.Id.ToString())) return; if (!ContainsSession(session.Id.ToString())) return;
Partecipants[session.Id.ToString()].IsBuffering = isBuffering; Participants[session.Id.ToString()].IsBuffering = isBuffering;
} }
/// <summary> /// <summary>
@ -129,7 +129,7 @@ namespace MediaBrowser.Controller.Syncplay
/// <value><c>true</c> if there is a session buffering in the group; <c>false</c> otherwise.</value> /// <value><c>true</c> if there is a session buffering in the group; <c>false</c> otherwise.</value>
public bool IsBuffering() public bool IsBuffering()
{ {
foreach (var session in Partecipants.Values) foreach (var session in Participants.Values)
{ {
if (session.IsBuffering) return true; if (session.IsBuffering) return true;
} }
@ -142,7 +142,7 @@ namespace MediaBrowser.Controller.Syncplay
/// <value><c>true</c> if the group is empty; <c>false</c> otherwise.</value> /// <value><c>true</c> if the group is empty; <c>false</c> otherwise.</value>
public bool IsEmpty() public bool IsEmpty()
{ {
return Partecipants.Count == 0; return Participants.Count == 0;
} }
} }
} }

View file

@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.Syncplay
/// <param name="session">The session.</param> /// <param name="session">The session.</param>
/// <param name="group">The group.</param> /// <param name="group">The group.</param>
/// <exception cref="InvalidOperationException"></exception> /// <exception cref="InvalidOperationException"></exception>
void MapSessionToGroup(SessionInfo session, ISyncplayController group); void AddSessionToGroup(SessionInfo session, ISyncplayController group);
/// <summary> /// <summary>
/// Unmaps a session from a group. /// Unmaps a session from a group.
@ -58,6 +58,6 @@ namespace MediaBrowser.Controller.Syncplay
/// <param name="session">The session.</param> /// <param name="session">The session.</param>
/// <param name="group">The group.</param> /// <param name="group">The group.</param>
/// <exception cref="InvalidOperationException"></exception> /// <exception cref="InvalidOperationException"></exception>
void UnmapSessionFromGroup(SessionInfo session, ISyncplayController group); void RemoveSessionFromGroup(SessionInfo session, ISyncplayController group);
} }
} }

View file

@ -1,7 +1,7 @@
namespace MediaBrowser.Model.Syncplay namespace MediaBrowser.Model.Syncplay
{ {
/// <summary> /// <summary>
/// Class GroupInfoModel. /// Class GroupInfoView.
/// </summary> /// </summary>
public class GroupInfoView public class GroupInfoView
{ {
@ -30,9 +30,9 @@ namespace MediaBrowser.Model.Syncplay
public long PositionTicks { get; set; } public long PositionTicks { get; set; }
/// <summary> /// <summary>
/// Gets or sets the partecipants. /// Gets or sets the participants.
/// </summary> /// </summary>
/// <value>The partecipants.</value> /// <value>The participants.</value>
public string[] Partecipants { get; set; } public string[] Participants { get; set; }
} }
} }

View file

@ -24,7 +24,7 @@ namespace MediaBrowser.Model.Syncplay
/// <summary> /// <summary>
/// A user is signaling that playback resumed. /// A user is signaling that playback resumed.
/// </summary> /// </summary>
BufferingComplete = 4, BufferingDone = 4,
/// <summary> /// <summary>
/// A user is reporting its ping. /// A user is reporting its ping.
/// </summary> /// </summary>