mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 01:54:42 +01:00
Handle ignore-wait request in waiting state in SyncPlay
This commit is contained in:
@@ -24,13 +24,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override GroupStateType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return GroupStateType.Idle;
|
||||
}
|
||||
}
|
||||
public override GroupStateType Type { get; } = GroupStateType.Idle;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void SessionJoined(IGroupStateContext context, GroupStateType prevState, SessionInfo session, CancellationToken cancellationToken)
|
||||
|
||||
@@ -25,13 +25,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override GroupStateType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return GroupStateType.Paused;
|
||||
}
|
||||
}
|
||||
public override GroupStateType Type { get; } = GroupStateType.Paused;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void SessionJoined(IGroupStateContext context, GroupStateType prevState, SessionInfo session, CancellationToken cancellationToken)
|
||||
|
||||
@@ -25,13 +25,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override GroupStateType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return GroupStateType.Playing;
|
||||
}
|
||||
}
|
||||
public override GroupStateType Type { get; } = GroupStateType.Playing;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether requests for buffering should be ignored.
|
||||
|
||||
@@ -25,13 +25,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override GroupStateType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return GroupStateType.Waiting;
|
||||
}
|
||||
}
|
||||
public override GroupStateType Type { get; } = GroupStateType.Waiting;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether playback should resume when group is ready.
|
||||
@@ -651,5 +645,31 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
Logger.LogDebug("HandleRequest: {0} in group {1}, no previous track available.", request.Type, context.GroupId.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, IgnoreWaitGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
context.SetIgnoreGroupWait(session, request.IgnoreWait);
|
||||
|
||||
if (!context.IsBuffering())
|
||||
{
|
||||
Logger.LogDebug("HandleRequest: {0} in group {1}, returning to previous state.", request.Type, context.GroupId.ToString());
|
||||
|
||||
if (ResumePlaying)
|
||||
{
|
||||
// Client, that was buffering, stopped following playback.
|
||||
var playingState = new PlayingGroupState(Logger);
|
||||
context.SetState(playingState);
|
||||
var unpauseRequest = new UnpauseGroupRequest();
|
||||
playingState.HandleRequest(context, Type, unpauseRequest, session, cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Group is ready, returning to previous state.
|
||||
var pausedState = new PausedGroupState(Logger);
|
||||
context.SetState(pausedState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user