BufferGroupRequest.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Threading;
  3. using MediaBrowser.Controller.Session;
  4. using MediaBrowser.Model.SyncPlay;
  5. namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
  6. {
  7. /// <summary>
  8. /// Class BufferGroupRequest.
  9. /// </summary>
  10. public class BufferGroupRequest : AbstractPlaybackRequest
  11. {
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="BufferGroupRequest"/> class.
  14. /// </summary>
  15. /// <param name="when">When the request has been made, as reported by the client.</param>
  16. /// <param name="positionTicks">The position ticks.</param>
  17. /// <param name="isPlaying">Whether the client playback is unpaused.</param>
  18. /// <param name="playlistItemId">The playlist item identifier of the playing item.</param>
  19. public BufferGroupRequest(DateTime when, long positionTicks, bool isPlaying, Guid playlistItemId)
  20. {
  21. When = when;
  22. PositionTicks = positionTicks;
  23. IsPlaying = isPlaying;
  24. PlaylistItemId = playlistItemId;
  25. }
  26. /// <summary>
  27. /// Gets when the request has been made by the client.
  28. /// </summary>
  29. /// <value>The date of the request.</value>
  30. public DateTime When { get; }
  31. /// <summary>
  32. /// Gets the position ticks.
  33. /// </summary>
  34. /// <value>The position ticks.</value>
  35. public long PositionTicks { get; }
  36. /// <summary>
  37. /// Gets a value indicating whether the client playback is unpaused.
  38. /// </summary>
  39. /// <value>The client playback status.</value>
  40. public bool IsPlaying { get; }
  41. /// <summary>
  42. /// Gets the playlist item identifier of the playing item.
  43. /// </summary>
  44. /// <value>The playlist item identifier.</value>
  45. public Guid PlaylistItemId { get; }
  46. /// <inheritdoc />
  47. public override PlaybackRequestType Action { get; } = PlaybackRequestType.Buffer;
  48. /// <inheritdoc />
  49. public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
  50. {
  51. state.HandleRequest(context, state.Type, this, session, cancellationToken);
  52. }
  53. }
  54. }