2020-09-24 23:04:21 +02:00
|
|
|
using System;
|
2020-11-13 15:13:32 +01:00
|
|
|
using System.Collections.Generic;
|
2020-05-12 19:05:05 +02:00
|
|
|
using System.Threading;
|
|
|
|
using MediaBrowser.Controller.Session;
|
2020-11-13 15:13:32 +01:00
|
|
|
using MediaBrowser.Model.SyncPlay;
|
2020-05-12 19:05:05 +02:00
|
|
|
|
2020-11-14 23:40:01 +01:00
|
|
|
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
2020-05-12 19:05:05 +02:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Class PlayGroupRequest.
|
|
|
|
/// </summary>
|
2020-11-13 15:13:32 +01:00
|
|
|
public class PlayGroupRequest : IGroupPlaybackRequest
|
2020-05-12 19:05:05 +02:00
|
|
|
{
|
2020-11-14 23:40:01 +01: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>
|
|
|
|
public PlayGroupRequest(Guid[] playingQueue, int playingItemPosition, long startPositionTicks)
|
|
|
|
{
|
|
|
|
var list = new List<Guid>();
|
|
|
|
list.AddRange(playingQueue);
|
|
|
|
PlayingQueue = list;
|
|
|
|
PlayingItemPosition = playingItemPosition;
|
|
|
|
StartPositionTicks = startPositionTicks;
|
|
|
|
}
|
|
|
|
|
2020-09-24 23:04:21 +02:00
|
|
|
/// <summary>
|
2020-11-13 15:13:32 +01:00
|
|
|
/// Gets the playing queue.
|
2020-09-24 23:04:21 +02:00
|
|
|
/// </summary>
|
|
|
|
/// <value>The playing queue.</value>
|
2020-11-14 23:40:01 +01:00
|
|
|
public IReadOnlyList<Guid> PlayingQueue { get; }
|
2020-09-24 23:04:21 +02:00
|
|
|
|
|
|
|
/// <summary>
|
2020-11-14 23:40:01 +01:00
|
|
|
/// Gets the position of the playing item in the queue.
|
2020-09-24 23:04:21 +02:00
|
|
|
/// </summary>
|
2020-11-14 23:40:01 +01:00
|
|
|
/// <value>The playing item position.</value>
|
|
|
|
public int PlayingItemPosition { get; }
|
2020-09-24 23:04:21 +02:00
|
|
|
|
|
|
|
/// <summary>
|
2020-11-14 23:40:01 +01:00
|
|
|
/// Gets the start position ticks.
|
2020-09-24 23:04:21 +02:00
|
|
|
/// </summary>
|
|
|
|
/// <value>The start position ticks.</value>
|
2020-11-14 23:40:01 +01:00
|
|
|
public long StartPositionTicks { get; }
|
2020-09-24 23:04:21 +02:00
|
|
|
|
2020-05-12 19:05:05 +02:00
|
|
|
/// <inheritdoc />
|
2020-11-13 15:13:32 +01:00
|
|
|
public PlaybackRequestType Type { get; } = PlaybackRequestType.Play;
|
2020-05-12 19:05:05 +02:00
|
|
|
|
|
|
|
/// <inheritdoc />
|
2020-11-13 15:13:32 +01:00
|
|
|
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
2020-05-12 19:05:05 +02:00
|
|
|
{
|
2020-11-13 15:13:32 +01:00
|
|
|
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
2020-05-12 19:05:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|