Added PlaybackSpeed to Group

This commit is contained in:
rzk3 2023-02-16 21:50:24 -05:00
parent 7b8b310cb5
commit 5161fbc67a
2 changed files with 33 additions and 3 deletions

View File

@ -61,6 +61,11 @@ namespace Emby.Server.Implementations.SyncPlay
/// </summary>
private IGroupState _state;
/// <summary>
/// The internal playback speed.
/// </summary>
private double? _playbackSpeed = 1.0;
/// <summary>
/// Initializes a new instance of the <see cref="Group" /> class.
/// </summary>
@ -137,6 +142,30 @@ namespace Emby.Server.Implementations.SyncPlay
/// <value>The last activity.</value>
public DateTime LastActivity { get; set; }
/// <summary>
/// Gets or sets the playback speed.
/// </summary>
/// <value>The playback speed.</value>
public double? PlaybackSpeed
{
get
{
return _playbackSpeed;
}
set
{
if (value is null)
{
_playbackSpeed = null;
}
else
{
_playbackSpeed = Math.Clamp((double)value, 0.1, 10.0);
}
}
}
/// <summary>
/// Adds the session to the group.
/// </summary>
@ -682,7 +711,8 @@ namespace Emby.Server.Implementations.SyncPlay
startPositionTicks,
isPlaying,
PlayQueue.ShuffleMode,
PlayQueue.RepeatMode);
PlayQueue.RepeatMode,
PlaybackSpeed);
}
}
}

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Model.SyncPlay
/// <param name="shuffleMode">The shuffle mode.</param>
/// <param name="repeatMode">The repeat mode.</param>
/// <param name="playbackSpeed">The playback speed.</param>
public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<QueueItem> playlist, int playingItemIndex, long startPositionTicks, bool isPlaying, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode, double playbackSpeed)
public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<QueueItem> playlist, int playingItemIndex, long startPositionTicks, bool isPlaying, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode, double? playbackSpeed)
{
Reason = reason;
LastUpdate = lastUpdate;
@ -82,7 +82,7 @@ namespace MediaBrowser.Model.SyncPlay
public GroupRepeatMode RepeatMode { get; }
/// <summary>
/// Gets the PlaybackSpeed
/// Gets the PlaybackSpeed.
/// </summary>
/// <value>The playback speed.</value>
public double? PlaybackSpeed { get; }