diff --git a/Jellyfin.Api/Controllers/MediaInfoController.cs b/Jellyfin.Api/Controllers/MediaInfoController.cs
index b42e6686ec..a76dc057a0 100644
--- a/Jellyfin.Api/Controllers/MediaInfoController.cs
+++ b/Jellyfin.Api/Controllers/MediaInfoController.cs
@@ -8,7 +8,6 @@ using Jellyfin.Api.Attributes;
using Jellyfin.Api.Constants;
using Jellyfin.Api.Helpers;
using Jellyfin.Api.Models.MediaInfoDtos;
-using Jellyfin.Api.Models.VideoDtos;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Library;
@@ -81,6 +80,9 @@ namespace Jellyfin.Api.Controllers
///
/// Gets live playback media info for an item.
///
+ ///
+ /// For backwards compatibility parameters can be sent via Query or Body, with Query having higher precedence.
+ ///
/// The item id.
/// The user id.
/// The maximum streaming bitrate.
@@ -90,13 +92,13 @@ namespace Jellyfin.Api.Controllers
/// The maximum number of audio channels.
/// The media source id.
/// The livestream id.
- /// The device profile.
/// Whether to auto open the livestream.
/// Whether to enable direct play. Default: true.
/// Whether to enable direct stream. Default: true.
/// Whether to enable transcoding. Default: true.
/// Whether to allow to copy the video stream. Default: true.
/// Whether to allow to copy the audio stream. Default: true.
+ /// The playback info.
/// Playback info returned.
/// A containing a with the playback info.
[HttpPost("Items/{itemId}/PlaybackInfo")]
@@ -111,18 +113,17 @@ namespace Jellyfin.Api.Controllers
[FromQuery] int? maxAudioChannels,
[FromQuery] string? mediaSourceId,
[FromQuery] string? liveStreamId,
- [FromBody] DeviceProfileDto? deviceProfile,
- [FromQuery] bool autoOpenLiveStream = false,
- [FromQuery] bool enableDirectPlay = true,
- [FromQuery] bool enableDirectStream = true,
- [FromQuery] bool enableTranscoding = true,
- [FromQuery] bool allowVideoStreamCopy = true,
- [FromQuery] bool allowAudioStreamCopy = true)
+ [FromQuery] bool? autoOpenLiveStream,
+ [FromQuery] bool? enableDirectPlay,
+ [FromQuery] bool? enableDirectStream,
+ [FromQuery] bool? enableTranscoding,
+ [FromQuery] bool? allowVideoStreamCopy,
+ [FromQuery] bool? allowAudioStreamCopy,
+ [FromBody] PlaybackInfoDto? playbackInfoDto)
{
var authInfo = _authContext.GetAuthorizationInfo(Request);
- var profile = deviceProfile?.DeviceProfile;
-
+ var profile = playbackInfoDto?.DeviceProfile;
_logger.LogInformation("GetPostedPlaybackInfo profile: {@Profile}", profile);
if (profile == null)
@@ -134,6 +135,23 @@ namespace Jellyfin.Api.Controllers
}
}
+ // Copy params from posted body
+ // TODO clean up when breaking API compatibility.
+ userId ??= playbackInfoDto?.UserId;
+ maxStreamingBitrate ??= playbackInfoDto?.MaxStreamingBitrate;
+ startTimeTicks ??= playbackInfoDto?.StartTimeTicks;
+ audioStreamIndex ??= playbackInfoDto?.AudioStreamIndex;
+ subtitleStreamIndex ??= playbackInfoDto?.SubtitleStreamIndex;
+ maxAudioChannels ??= playbackInfoDto?.MaxAudioChannels;
+ mediaSourceId ??= playbackInfoDto?.MediaSourceId;
+ liveStreamId ??= playbackInfoDto?.LiveStreamId;
+ autoOpenLiveStream ??= playbackInfoDto?.AutoOpenLiveStream ?? false;
+ enableDirectPlay ??= playbackInfoDto?.EnableDirectPlay ?? true;
+ enableDirectStream ??= playbackInfoDto?.EnableDirectStream ?? true;
+ enableTranscoding ??= playbackInfoDto?.EnableTranscoding ?? true;
+ allowVideoStreamCopy ??= playbackInfoDto?.AllowVideoStreamCopy ?? true;
+ allowAudioStreamCopy ??= playbackInfoDto?.AllowAudioStreamCopy ?? true;
+
var info = await _mediaInfoHelper.GetPlaybackInfo(
itemId,
userId,
@@ -161,18 +179,18 @@ namespace Jellyfin.Api.Controllers
maxAudioChannels,
info!.PlaySessionId!,
userId ?? Guid.Empty,
- enableDirectPlay,
- enableDirectStream,
- enableTranscoding,
- allowVideoStreamCopy,
- allowAudioStreamCopy,
+ enableDirectPlay.Value,
+ enableDirectStream.Value,
+ enableTranscoding.Value,
+ allowVideoStreamCopy.Value,
+ allowAudioStreamCopy.Value,
Request.HttpContext.GetNormalizedRemoteIp());
}
_mediaInfoHelper.SortMediaSources(info, maxStreamingBitrate);
}
- if (autoOpenLiveStream)
+ if (autoOpenLiveStream.Value)
{
var mediaSource = string.IsNullOrWhiteSpace(mediaSourceId) ? info.MediaSources[0] : info.MediaSources.FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.Ordinal));
@@ -183,9 +201,9 @@ namespace Jellyfin.Api.Controllers
new LiveStreamRequest
{
AudioStreamIndex = audioStreamIndex,
- DeviceProfile = deviceProfile?.DeviceProfile,
- EnableDirectPlay = enableDirectPlay,
- EnableDirectStream = enableDirectStream,
+ DeviceProfile = playbackInfoDto?.DeviceProfile,
+ EnableDirectPlay = enableDirectPlay.Value,
+ EnableDirectStream = enableDirectStream.Value,
ItemId = itemId,
MaxAudioChannels = maxAudioChannels,
MaxStreamingBitrate = maxStreamingBitrate,
diff --git a/Jellyfin.Api/Models/MediaInfoDtos/PlaybackInfoDto.cs b/Jellyfin.Api/Models/MediaInfoDtos/PlaybackInfoDto.cs
new file mode 100644
index 0000000000..2cfdba507e
--- /dev/null
+++ b/Jellyfin.Api/Models/MediaInfoDtos/PlaybackInfoDto.cs
@@ -0,0 +1,86 @@
+using System;
+using MediaBrowser.Model.Dlna;
+
+namespace Jellyfin.Api.Models.MediaInfoDtos
+{
+ ///
+ /// Plabyback info dto.
+ ///
+ public class PlaybackInfoDto
+ {
+ ///
+ /// Gets or sets the playback userId.
+ ///
+ public Guid? UserId { get; set; }
+
+ ///
+ /// Gets or sets the max streaming bitrate.
+ ///
+ public int? MaxStreamingBitrate { get; set; }
+
+ ///
+ /// Gets or sets the start time in ticks.
+ ///
+ public long? StartTimeTicks { get; set; }
+
+ ///
+ /// Gets or sets the audio stream index.
+ ///
+ public int? AudioStreamIndex { get; set; }
+
+ ///
+ /// Gets or sets the subtitle stream index.
+ ///
+ public int? SubtitleStreamIndex { get; set; }
+
+ ///
+ /// Gets or sets the max audio channels.
+ ///
+ public int? MaxAudioChannels { get; set; }
+
+ ///
+ /// Gets or sets the media source id.
+ ///
+ public string? MediaSourceId { get; set; }
+
+ ///
+ /// Gets or sets the live stream id.
+ ///
+ public string? LiveStreamId { get; set; }
+
+ ///
+ /// Gets or sets the device profile.
+ ///
+ public DeviceProfile? DeviceProfile { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether to enable direct play.
+ ///
+ public bool? EnableDirectPlay { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether to enable direct stream.
+ ///
+ public bool? EnableDirectStream { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether to enable transcoding.
+ ///
+ public bool? EnableTranscoding { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether to enable video stream copy.
+ ///
+ public bool? AllowVideoStreamCopy { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether to allow audio stream copy.
+ ///
+ public bool? AllowAudioStreamCopy { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether to auto open the live stream.
+ ///
+ public bool? AutoOpenLiveStream { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Jellyfin.Api/Models/VideoDtos/DeviceProfileDto.cs b/Jellyfin.Api/Models/VideoDtos/DeviceProfileDto.cs
deleted file mode 100644
index db55dc34b5..0000000000
--- a/Jellyfin.Api/Models/VideoDtos/DeviceProfileDto.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using MediaBrowser.Model.Dlna;
-
-namespace Jellyfin.Api.Models.VideoDtos
-{
- ///
- /// Device profile dto.
- ///
- public class DeviceProfileDto
- {
- ///
- /// Gets or sets device profile.
- ///
- public DeviceProfile? DeviceProfile { get; set; }
- }
-}