using System;
using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
///
/// Class BufferGroupRequest.
///
public class BufferGroupRequest : AbstractPlaybackRequest
{
///
/// Initializes a new instance of the class.
///
/// When the request has been made, as reported by the client.
/// The position ticks.
/// Whether the client playback is unpaused.
/// The playlist item identifier of the playing item.
public BufferGroupRequest(DateTime when, long positionTicks, bool isPlaying, Guid playlistItemId)
{
When = when;
PositionTicks = positionTicks;
IsPlaying = isPlaying;
PlaylistItemId = playlistItemId;
}
///
/// Gets when the request has been made by the client.
///
/// The date of the request.
public DateTime When { get; }
///
/// Gets the position ticks.
///
/// The position ticks.
public long PositionTicks { get; }
///
/// Gets a value indicating whether the client playback is unpaused.
///
/// The client playback status.
public bool IsPlaying { get; }
///
/// Gets the playlist item identifier of the playing item.
///
/// The playlist item identifier.
public Guid PlaylistItemId { get; }
///
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Buffer;
///
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
{
state.HandleRequest(this, context, state.Type, session, cancellationToken);
}
}
}