mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-13 11:10:24 +01:00
update live tv return object
This commit is contained in:
@@ -859,19 +859,12 @@ namespace MediaBrowser.Api.Playback
|
||||
|
||||
state.LiveTvStreamId = streamInfo.Id;
|
||||
|
||||
if (!string.IsNullOrEmpty(streamInfo.Path))
|
||||
{
|
||||
state.MediaPath = streamInfo.Path;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(streamInfo.Url))
|
||||
{
|
||||
state.MediaPath = streamInfo.Url;
|
||||
}
|
||||
state.MediaPath = streamInfo.Path;
|
||||
state.InputProtocol = streamInfo.Protocol;
|
||||
|
||||
await Task.Delay(1500, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
|
||||
state.InputProtocol = GetProtocol(state.MediaPath);
|
||||
AttachMediaStreamInfo(state, streamInfo.MediaStreams, state.VideoRequest, state.RequestedUrl);
|
||||
|
||||
AttachMediaStreamInfo(state, streamInfo, state.VideoRequest, state.RequestedUrl);
|
||||
checkCodecs = true;
|
||||
}
|
||||
|
||||
@@ -882,19 +875,12 @@ namespace MediaBrowser.Api.Playback
|
||||
|
||||
state.LiveTvStreamId = streamInfo.Id;
|
||||
|
||||
if (!string.IsNullOrEmpty(streamInfo.Path))
|
||||
{
|
||||
state.MediaPath = streamInfo.Path;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(streamInfo.Url))
|
||||
{
|
||||
state.MediaPath = streamInfo.Url;
|
||||
}
|
||||
state.MediaPath = streamInfo.Path;
|
||||
state.InputProtocol = streamInfo.Protocol;
|
||||
|
||||
await Task.Delay(1500, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
|
||||
state.InputProtocol = GetProtocol(state.MediaPath);
|
||||
AttachMediaStreamInfo(state, streamInfo.MediaStreams, state.VideoRequest, state.RequestedUrl);
|
||||
AttachMediaStreamInfo(state, streamInfo, state.VideoRequest, state.RequestedUrl);
|
||||
checkCodecs = true;
|
||||
}
|
||||
|
||||
@@ -1006,7 +992,7 @@ namespace MediaBrowser.Api.Playback
|
||||
await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (state.IsInputVideo && transcodingJob.Type == Api.TranscodingJobType.Progressive)
|
||||
if (state.IsInputVideo && transcodingJob.Type == TranscodingJobType.Progressive)
|
||||
{
|
||||
await Task.Delay(1000, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
|
||||
@@ -1712,6 +1698,23 @@ namespace MediaBrowser.Api.Playback
|
||||
return state;
|
||||
}
|
||||
|
||||
private void AttachMediaStreamInfo(StreamState state,
|
||||
ChannelMediaInfo mediaInfo,
|
||||
VideoStreamRequest videoRequest,
|
||||
string requestedUrl)
|
||||
{
|
||||
var mediaSource = mediaInfo.ToMediaSource();
|
||||
|
||||
state.InputProtocol = mediaSource.Protocol;
|
||||
state.MediaPath = mediaSource.Path;
|
||||
state.RunTimeTicks = mediaSource.RunTimeTicks;
|
||||
state.RemoteHttpHeaders = mediaSource.RequiredHttpHeaders;
|
||||
state.InputBitrate = mediaSource.Bitrate;
|
||||
state.InputFileSize = mediaSource.Size;
|
||||
|
||||
AttachMediaStreamInfo(state, mediaSource.MediaStreams, videoRequest, requestedUrl);
|
||||
}
|
||||
|
||||
private void AttachMediaStreamInfo(StreamState state,
|
||||
List<MediaStream> mediaStreams,
|
||||
VideoStreamRequest videoRequest,
|
||||
|
||||
@@ -103,7 +103,9 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
var builder = new StringBuilder();
|
||||
|
||||
var duration = "PT0H02M11.00S";
|
||||
var time = TimeSpan.FromTicks(state.RunTimeTicks.Value);
|
||||
|
||||
var duration = "PT" + time.Hours.ToString("00", UsCulture) + "H" + time.Minutes.ToString("00", UsCulture) + "M" + time.Seconds.ToString("00", UsCulture) + ".00S";
|
||||
|
||||
builder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
builder.AppendFormat(
|
||||
@@ -239,16 +241,17 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
{
|
||||
var seconds = TimeSpan.FromTicks(state.RunTimeTicks ?? 0).TotalSeconds;
|
||||
|
||||
builder.Append("<SegmentList timescale=\"1000\" duration=\"10000\">");
|
||||
|
||||
var queryStringIndex = Request.RawUrl.IndexOf('?');
|
||||
var queryString = queryStringIndex == -1 ? string.Empty : Request.RawUrl.Substring(queryStringIndex);
|
||||
|
||||
var index = 0;
|
||||
builder.Append("<SegmentList timescale=\"1000\" duration=\"10000\">");
|
||||
|
||||
while (seconds > 0)
|
||||
{
|
||||
builder.AppendFormat("<SegmentURL media=\"{0}.ts{1}\"/>", index.ToString(UsCulture), SecurityElement.Escape(queryString));
|
||||
var segmentUrl = string.Format("{0}.ts{1}", index.ToString(UsCulture), SecurityElement.Escape(queryString));
|
||||
|
||||
builder.AppendFormat("<SegmentURL media=\"{0}\"/>", segmentUrl);
|
||||
|
||||
seconds -= state.SegmentLength;
|
||||
index++;
|
||||
|
||||
Reference in New Issue
Block a user