rzk3 1 month ago committed by GitHub
commit 893f4600fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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

@ -11,6 +11,8 @@ namespace MediaBrowser.Model.Session
/// </summary> /// </summary>
public class PlaybackProgressInfo public class PlaybackProgressInfo
{ {
private float? _playbackSpeed = 1.0f;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this instance can seek. /// Gets or sets a value indicating whether this instance can seek.
/// </summary> /// </summary>
@ -116,5 +118,15 @@ namespace MediaBrowser.Model.Session
public QueueItem[] NowPlayingQueue { get; set; } public QueueItem[] NowPlayingQueue { get; set; }
public string PlaylistItemId { 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);
}
} }
} }

@ -1,10 +1,14 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Session namespace MediaBrowser.Model.Session
{ {
public class PlayerStateInfo public class PlayerStateInfo
{ {
private float? _playbackSpeed = 1.0f;
/// <summary> /// <summary>
/// Gets or sets the now playing position ticks. /// Gets or sets the now playing position ticks.
/// </summary> /// </summary>
@ -76,5 +80,15 @@ namespace MediaBrowser.Model.Session
/// </summary> /// </summary>
/// <value>The live stream identifier.</value> /// <value>The live stream identifier.</value>
public string LiveStreamId { get; set; } 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);
}
} }
} }

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

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

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

Loading…
Cancel
Save