This commit is contained in:
rzk3 2024-04-25 09:15:44 -04:00 committed by GitHub
commit b87f1b9407
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 64 additions and 4 deletions

View File

@ -62,6 +62,11 @@ namespace Emby.Server.Implementations.SyncPlay
/// </summary>
private IGroupState _state;
/// <summary>
/// The internal playback speed.
/// </summary>
private float? _playbackSpeed = 1.0f;
/// <summary>
/// Initializes a new instance of the <see cref="Group" /> class.
/// </summary>
@ -138,6 +143,16 @@ 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 float? PlaybackSpeed
{
get => _playbackSpeed;
set => _playbackSpeed = value is null ? null : (float?)Math.Round(Math.Clamp(value.Value, 0.1f, 10.0f), 1);
}
/// <summary>
/// Adds the session to the group.
/// </summary>
@ -679,7 +694,8 @@ namespace Emby.Server.Implementations.SyncPlay
startPositionTicks,
isPlaying,
PlayQueue.ShuffleMode,
PlayQueue.RepeatMode);
PlayQueue.RepeatMode,
PlaybackSpeed);
}
}
}

View File

@ -11,6 +11,8 @@ namespace MediaBrowser.Model.Session
/// </summary>
public class PlaybackProgressInfo
{
private float? _playbackSpeed = 1.0f;
/// <summary>
/// Gets or sets a value indicating whether this instance can seek.
/// </summary>
@ -116,5 +118,15 @@ namespace MediaBrowser.Model.Session
public QueueItem[] NowPlayingQueue { get; set; }
public string PlaylistItemId { get; set; }
/// <summary>
/// Gets or sets the playback speed.
/// </summary>
/// <value>The playback speed.</value>
public float? PlaybackSpeed
{
get => _playbackSpeed;
set => _playbackSpeed = value is null ? null : (float?)Math.Round(Math.Clamp(value.Value, 0.1f, 10.0f), 1);
}
}
}

View File

@ -1,10 +1,14 @@
#nullable disable
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Session
{
public class PlayerStateInfo
{
private float? _playbackSpeed = 1.0f;
/// <summary>
/// Gets or sets the now playing position ticks.
/// </summary>
@ -76,5 +80,15 @@ namespace MediaBrowser.Model.Session
/// </summary>
/// <value>The live stream identifier.</value>
public string LiveStreamId { get; set; }
/// <summary>
/// Gets or sets the playback speed.
/// </summary>
/// <value>The playback speed.</value>
public float? PlaybackSpeed
{
get => _playbackSpeed;
set => _playbackSpeed = value is null ? null : (float?)Math.Round(Math.Clamp(value.Value, 0.1f, 10.0f), 1);
}
}
}

View File

@ -19,7 +19,8 @@ namespace MediaBrowser.Model.SyncPlay
/// <param name="isPlaying">The playing item status.</param>
/// <param name="shuffleMode">The shuffle mode.</param>
/// <param name="repeatMode">The repeat mode.</param>
public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<SyncPlayQueueItem> playlist, int playingItemIndex, long startPositionTicks, bool isPlaying, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode)
/// <param name="playbackSpeed">The playback speed.</param>
public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<SyncPlayQueueItem> playlist, int playingItemIndex, long startPositionTicks, bool isPlaying, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode, float? playbackSpeed)
{
Reason = reason;
LastUpdate = lastUpdate;
@ -29,6 +30,7 @@ namespace MediaBrowser.Model.SyncPlay
IsPlaying = isPlaying;
ShuffleMode = shuffleMode;
RepeatMode = repeatMode;
PlaybackSpeed = playbackSpeed is null ? null : (float?)Math.Round(Math.Clamp(playbackSpeed.Value, 0.1f, 10.0f), 1);
}
/// <summary>
@ -78,5 +80,11 @@ namespace MediaBrowser.Model.SyncPlay
/// </summary>
/// <value>The repeat mode.</value>
public GroupRepeatMode RepeatMode { get; }
/// <summary>
/// Gets the PlaybackSpeed.
/// </summary>
/// <value>The playback speed.</value>
public float? PlaybackSpeed { get; }
}
}

View File

@ -53,6 +53,11 @@ namespace MediaBrowser.Model.SyncPlay
/// <summary>
/// A user is changing shuffle mode.
/// </summary>
ShuffleMode = 9
ShuffleMode = 9,
/// <summary>
/// A user has changed the playback speed.
/// </summary>
PlaybackSpeedChange = 10
}
}

View File

@ -88,6 +88,11 @@ namespace MediaBrowser.Model.SyncPlay
/// <summary>
/// A user is requesting to be ignored on group wait.
/// </summary>
IgnoreWait = 16
IgnoreWait = 16,
/// <summary>
/// A user is requesting to change the playback speed.
/// </summary>
SetPlaybackSpeed = 17
}
}