2021-05-06 18:39:20 -04:00
|
|
|
#nullable disable
|
|
|
|
|
2020-09-24 17:04:21 -04:00
|
|
|
using System;
|
2020-11-13 09:13:32 -05:00
|
|
|
using System.Collections.Generic;
|
2020-05-12 13:05:05 -04:00
|
|
|
using System.Threading;
|
|
|
|
using MediaBrowser.Controller.Session;
|
2020-11-13 09:13:32 -05:00
|
|
|
using MediaBrowser.Model.SyncPlay;
|
2020-05-12 13:05:05 -04:00
|
|
|
|
2020-11-14 17:40:01 -05:00
|
|
|
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
2020-05-12 13:05:05 -04:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Class PlayGroupRequest.
|
|
|
|
/// </summary>
|
2020-11-28 10:03:02 -05:00
|
|
|
public class PlayGroupRequest : AbstractPlaybackRequest
|
2020-05-12 13:05:05 -04:00
|
|
|
{
|
2020-11-14 17:40:01 -05: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 08:19:24 -05:00
|
|
|
public PlayGroupRequest(IReadOnlyList<Guid> playingQueue, int playingItemPosition, long startPositionTicks)
|
2020-11-14 17:40:01 -05:00
|
|
|
{
|
2020-11-15 11:03:27 -05:00
|
|
|
PlayingQueue = playingQueue ?? Array.Empty<Guid>();
|
2020-11-14 17:40:01 -05:00
|
|
|
PlayingItemPosition = playingItemPosition;
|
|
|
|
StartPositionTicks = startPositionTicks;
|
|
|
|
}
|
|
|
|
|
2020-09-24 17:04:21 -04:00
|
|
|
/// <summary>
|
2020-11-13 09:13:32 -05:00
|
|
|
/// Gets the playing queue.
|
2020-09-24 17:04:21 -04:00
|
|
|
/// </summary>
|
|
|
|
/// <value>The playing queue.</value>
|
2020-11-14 17:40:01 -05:00
|
|
|
public IReadOnlyList<Guid> PlayingQueue { get; }
|
2020-09-24 17:04:21 -04:00
|
|
|
|
|
|
|
/// <summary>
|
2020-11-14 17:40:01 -05:00
|
|
|
/// Gets the position of the playing item in the queue.
|
2020-09-24 17:04:21 -04:00
|
|
|
/// </summary>
|
2020-11-14 17:40:01 -05:00
|
|
|
/// <value>The playing item position.</value>
|
|
|
|
public int PlayingItemPosition { get; }
|
2020-09-24 17:04:21 -04:00
|
|
|
|
|
|
|
/// <summary>
|
2020-11-14 17:40:01 -05:00
|
|
|
/// Gets the start position ticks.
|
2020-09-24 17:04:21 -04:00
|
|
|
/// </summary>
|
|
|
|
/// <value>The start position ticks.</value>
|
2020-11-14 17:40:01 -05:00
|
|
|
public long StartPositionTicks { get; }
|
2020-09-24 17:04:21 -04:00
|
|
|
|
2020-05-12 13:05:05 -04:00
|
|
|
/// <inheritdoc />
|
2020-11-28 10:03:02 -05:00
|
|
|
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Play;
|
2020-05-12 13:05:05 -04:00
|
|
|
|
|
|
|
/// <inheritdoc />
|
2020-11-28 10:03:02 -05:00
|
|
|
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
2020-05-12 13:05:05 -04:00
|
|
|
{
|
2020-12-04 17:16:15 -05:00
|
|
|
state.HandleRequest(this, context, state.Type, session, cancellationToken);
|
2020-05-12 13:05:05 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|