Send playing item status in SyncPlay group update

This commit is contained in:
Ionut Andrei Oanca 2021-03-29 11:29:48 +02:00
parent 9eb740ba57
commit 776ce7c660
2 changed files with 12 additions and 2 deletions

View File

@ -647,8 +647,9 @@ namespace Emby.Server.Implementations.SyncPlay
public PlayQueueUpdate GetPlayQueueUpdate(PlayQueueUpdateReason reason) public PlayQueueUpdate GetPlayQueueUpdate(PlayQueueUpdateReason reason)
{ {
var startPositionTicks = PositionTicks; var startPositionTicks = PositionTicks;
var isPlaying = _state.Type.Equals(GroupStateType.Playing);
if (_state.Type.Equals(GroupStateType.Playing)) if (isPlaying)
{ {
var currentTime = DateTime.UtcNow; var currentTime = DateTime.UtcNow;
var elapsedTime = currentTime - LastActivity; var elapsedTime = currentTime - LastActivity;
@ -667,6 +668,7 @@ namespace Emby.Server.Implementations.SyncPlay
PlayQueue.GetPlaylist(), PlayQueue.GetPlaylist(),
PlayQueue.PlayingItemIndex, PlayQueue.PlayingItemIndex,
startPositionTicks, startPositionTicks,
isPlaying,
PlayQueue.ShuffleMode, PlayQueue.ShuffleMode,
PlayQueue.RepeatMode); PlayQueue.RepeatMode);
} }

View File

@ -16,15 +16,17 @@ namespace MediaBrowser.Model.SyncPlay
/// <param name="playlist">The playlist.</param> /// <param name="playlist">The playlist.</param>
/// <param name="playingItemIndex">The playing item index in the playlist.</param> /// <param name="playingItemIndex">The playing item index in the playlist.</param>
/// <param name="startPositionTicks">The start position ticks.</param> /// <param name="startPositionTicks">The start position ticks.</param>
/// <param name="isPlaying">The playing item status.</param>
/// <param name="shuffleMode">The shuffle mode.</param> /// <param name="shuffleMode">The shuffle mode.</param>
/// <param name="repeatMode">The repeat mode.</param> /// <param name="repeatMode">The repeat mode.</param>
public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<QueueItem> playlist, int playingItemIndex, long startPositionTicks, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode) public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<QueueItem> playlist, int playingItemIndex, long startPositionTicks, bool isPlaying, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode)
{ {
Reason = reason; Reason = reason;
LastUpdate = lastUpdate; LastUpdate = lastUpdate;
Playlist = playlist; Playlist = playlist;
PlayingItemIndex = playingItemIndex; PlayingItemIndex = playingItemIndex;
StartPositionTicks = startPositionTicks; StartPositionTicks = startPositionTicks;
IsPlaying = isPlaying;
ShuffleMode = shuffleMode; ShuffleMode = shuffleMode;
RepeatMode = repeatMode; RepeatMode = repeatMode;
} }
@ -59,6 +61,12 @@ namespace MediaBrowser.Model.SyncPlay
/// <value>The start position ticks.</value> /// <value>The start position ticks.</value>
public long StartPositionTicks { get; } public long StartPositionTicks { get; }
/// <summary>
/// Gets a value indicating whether the current item is playing.
/// </summary>
/// <value>The playing item status.</value>
public bool IsPlaying { get; }
/// <summary> /// <summary>
/// Gets the shuffle mode. /// Gets the shuffle mode.
/// </summary> /// </summary>