public override void HandleRequest(SeekGroupRequest request, IGroupStateContext context, GroupStateType prevState, SessionInfo session, CancellationToken cancellationToken) { // Save state if first event. if (!InitialStateSet) { InitialState = prevState; InitialStateSet = true; } if (prevState.Equals(GroupStateType.Playing)) { ResumePlaying = true; } else if (prevState.Equals(GroupStateType.Paused)) { ResumePlaying = false; } // Sanitize PositionTicks. var ticks = context.SanitizePositionTicks(request.PositionTicks); // Seek. context.PositionTicks = ticks; context.LastActivity = DateTime.UtcNow; var command = context.NewSyncPlayCommand(SendCommandType.Seek); context.SendCommand(session, SyncPlayBroadcastType.AllGroup, command, cancellationToken); // Reset status of sessions and await for all Ready events. context.SetAllBuffering(true); // Notify relevant state change event. SendGroupStateUpdate(context, request, session, cancellationToken); }
public override void HandleRequest(SeekGroupRequest request, IGroupStateContext context, GroupStateType prevState, SessionInfo session, CancellationToken cancellationToken) { // Change state. var waitingState = new WaitingGroupState(LoggerFactory); context.SetState(waitingState); waitingState.HandleRequest(request, context, Type, session, cancellationToken); }
public ActionResult SyncPlaySeek( [FromBody, Required] SeekRequestDto requestData) { var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request); var syncPlayRequest = new SeekGroupRequest(requestData.PositionTicks); _syncPlayManager.HandleRequest(currentSession, syncPlayRequest, CancellationToken.None); return(NoContent()); }
public virtual void HandleRequest(SeekGroupRequest request, IGroupStateContext context, GroupStateType prevState, SessionInfo session, CancellationToken cancellationToken) { UnhandledRequest(request); }
public override void HandleRequest(SeekGroupRequest request, IGroupStateContext context, GroupStateType prevState, SessionInfo session, CancellationToken cancellationToken) { SendStopCommand(context, prevState, session, cancellationToken); }