Merge pull request #4824 from crobibero/livestream-post-body

Add request parameters to OpenLiveStreamDto
This commit is contained in:
Claus Vium 2020-12-21 23:10:46 +01:00 committed by GitHub
commit 53119ed2a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 69 additions and 14 deletions

View File

@ -259,24 +259,24 @@ namespace Jellyfin.Api.Controllers
[FromQuery] int? subtitleStreamIndex, [FromQuery] int? subtitleStreamIndex,
[FromQuery] int? maxAudioChannels, [FromQuery] int? maxAudioChannels,
[FromQuery] Guid? itemId, [FromQuery] Guid? itemId,
[FromBody] OpenLiveStreamDto openLiveStreamDto, [FromBody] OpenLiveStreamDto? openLiveStreamDto,
[FromQuery] bool enableDirectPlay = true, [FromQuery] bool? enableDirectPlay,
[FromQuery] bool enableDirectStream = true) [FromQuery] bool? enableDirectStream)
{ {
var request = new LiveStreamRequest var request = new LiveStreamRequest
{ {
OpenToken = openToken, OpenToken = openToken ?? openLiveStreamDto?.OpenToken,
UserId = userId ?? Guid.Empty, UserId = userId ?? openLiveStreamDto?.UserId ?? Guid.Empty,
PlaySessionId = playSessionId, PlaySessionId = playSessionId ?? openLiveStreamDto?.PlaySessionId,
MaxStreamingBitrate = maxStreamingBitrate, MaxStreamingBitrate = maxStreamingBitrate ?? openLiveStreamDto?.MaxStreamingBitrate,
StartTimeTicks = startTimeTicks, StartTimeTicks = startTimeTicks ?? openLiveStreamDto?.StartTimeTicks,
AudioStreamIndex = audioStreamIndex, AudioStreamIndex = audioStreamIndex ?? openLiveStreamDto?.AudioStreamIndex,
SubtitleStreamIndex = subtitleStreamIndex, SubtitleStreamIndex = subtitleStreamIndex ?? openLiveStreamDto?.SubtitleStreamIndex,
MaxAudioChannels = maxAudioChannels, MaxAudioChannels = maxAudioChannels ?? openLiveStreamDto?.MaxAudioChannels,
ItemId = itemId ?? Guid.Empty, ItemId = itemId ?? openLiveStreamDto?.ItemId ?? Guid.Empty,
DeviceProfile = openLiveStreamDto?.DeviceProfile, DeviceProfile = openLiveStreamDto?.DeviceProfile,
EnableDirectPlay = enableDirectPlay, EnableDirectPlay = enableDirectPlay ?? openLiveStreamDto?.EnableDirectPlay ?? true,
EnableDirectStream = enableDirectStream, EnableDirectStream = enableDirectStream ?? openLiveStreamDto?.EnableDirectStream ?? true,
DirectPlayProtocols = openLiveStreamDto?.DirectPlayProtocols ?? new[] { MediaProtocol.Http } DirectPlayProtocols = openLiveStreamDto?.DirectPlayProtocols ?? new[] { MediaProtocol.Http }
}; };
return await _mediaInfoHelper.OpenMediaSource(Request, request).ConfigureAwait(false); return await _mediaInfoHelper.OpenMediaSource(Request, request).ConfigureAwait(false);

View File

@ -10,6 +10,61 @@ namespace Jellyfin.Api.Models.MediaInfoDtos
/// </summary> /// </summary>
public class OpenLiveStreamDto public class OpenLiveStreamDto
{ {
/// <summary>
/// Gets or sets the open token.
/// </summary>
public string? OpenToken { get; set; }
/// <summary>
/// Gets or sets the user id.
/// </summary>
public Guid? UserId { get; set; }
/// <summary>
/// Gets or sets the play session id.
/// </summary>
public string? PlaySessionId { get; set; }
/// <summary>
/// Gets or sets the max streaming bitrate.
/// </summary>
public int? MaxStreamingBitrate { get; set; }
/// <summary>
/// Gets or sets the start time in ticks.
/// </summary>
public long? StartTimeTicks { get; set; }
/// <summary>
/// Gets or sets the audio stream index.
/// </summary>
public int? AudioStreamIndex { get; set; }
/// <summary>
/// Gets or sets the subtitle stream index.
/// </summary>
public int? SubtitleStreamIndex { get; set; }
/// <summary>
/// Gets or sets the max audio channels.
/// </summary>
public int? MaxAudioChannels { get; set; }
/// <summary>
/// Gets or sets the item id.
/// </summary>
public Guid? ItemId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to enable direct play.
/// </summary>
public bool? EnableDirectPlay { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to enale direct stream.
/// </summary>
public bool? EnableDirectStream { get; set; }
/// <summary> /// <summary>
/// Gets or sets the device profile. /// Gets or sets the device profile.
/// </summary> /// </summary>