2020-09-24 21:04:21 +00:00
|
|
|
using System;
|
2020-11-13 14:13:32 +00:00
|
|
|
using System.Collections.Generic;
|
2020-05-12 17:05:05 +00:00
|
|
|
using System.Threading;
|
|
|
|
using MediaBrowser.Controller.Session;
|
2020-11-13 14:13:32 +00:00
|
|
|
using MediaBrowser.Model.SyncPlay;
|
2020-05-12 17:05:05 +00:00
|
|
|
|
2020-11-14 22:40:01 +00:00
|
|
|
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
2020-05-12 17:05:05 +00:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Class PlayGroupRequest.
|
|
|
|
/// </summary>
|
2020-11-28 15:03:02 +00:00
|
|
|
public class PlayGroupRequest : AbstractPlaybackRequest
|
2020-05-12 17:05:05 +00:00
|
|
|
{
|
2020-11-14 22:40:01 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="PlayGroupRequest"/> class.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="playingQueue">The playing queue.</param>
|
|
|
|
/// <param name="playingItemPosition">The playing item position.</param>
|
|
|
|
/// <param name="startPositionTicks">The start position ticks.</param>
|
2020-11-28 13:19:24 +00:00
|
|
|
public PlayGroupRequest(IReadOnlyList<Guid> playingQueue, int playingItemPosition, long startPositionTicks)
|
2020-11-14 22:40:01 +00:00
|
|
|
{
|
2020-11-15 16:03:27 +00:00
|
|
|
PlayingQueue = playingQueue ?? Array.Empty<Guid>();
|
2020-11-14 22:40:01 +00:00
|
|
|
PlayingItemPosition = playingItemPosition;
|
|
|
|
StartPositionTicks = startPositionTicks;
|
|
|
|
}
|
|
|
|
|
2020-09-24 21:04:21 +00:00
|
|
|
/// <summary>
|
2020-11-13 14:13:32 +00:00
|
|
|
/// Gets the playing queue.
|
2020-09-24 21:04:21 +00:00
|
|
|
/// </summary>
|
|
|
|
/// <value>The playing queue.</value>
|
2020-11-14 22:40:01 +00:00
|
|
|
public IReadOnlyList<Guid> PlayingQueue { get; }
|
2020-09-24 21:04:21 +00:00
|
|
|
|
|
|
|
/// <summary>
|
2020-11-14 22:40:01 +00:00
|
|
|
/// Gets the position of the playing item in the queue.
|
2020-09-24 21:04:21 +00:00
|
|
|
/// </summary>
|
2020-11-14 22:40:01 +00:00
|
|
|
/// <value>The playing item position.</value>
|
|
|
|
public int PlayingItemPosition { get; }
|
2020-09-24 21:04:21 +00:00
|
|
|
|
|
|
|
/// <summary>
|
2020-11-14 22:40:01 +00:00
|
|
|
/// Gets the start position ticks.
|
2020-09-24 21:04:21 +00:00
|
|
|
/// </summary>
|
|
|
|
/// <value>The start position ticks.</value>
|
2020-11-14 22:40:01 +00:00
|
|
|
public long StartPositionTicks { get; }
|
2020-09-24 21:04:21 +00:00
|
|
|
|
2020-05-12 17:05:05 +00:00
|
|
|
/// <inheritdoc />
|
2020-11-28 15:03:02 +00:00
|
|
|
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Play;
|
2020-05-12 17:05:05 +00:00
|
|
|
|
|
|
|
/// <inheritdoc />
|
2020-11-28 15:03:02 +00:00
|
|
|
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
2020-05-12 17:05:05 +00:00
|
|
|
{
|
2020-12-04 22:16:15 +00:00
|
|
|
state.HandleRequest(this, context, state.Type, session, cancellationToken);
|
2020-05-12 17:05:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|