mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
removed http web request dependency from api project
This commit is contained in:
parent
7512e3b430
commit
4a29bb012b
@ -58,7 +58,6 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.XML" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -1,5 +1,4 @@
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.MediaInfo;
|
||||
using MediaBrowser.Common.MediaInfo;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Dto;
|
||||
@ -23,8 +22,8 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
/// <summary>
|
||||
/// Class GetHlsAudioSegment
|
||||
/// </summary>
|
||||
[Route("/Audio/{Id}/segments/{SegmentId}/stream.mp3", "GET")]
|
||||
[Route("/Audio/{Id}/segments/{SegmentId}/stream.aac", "GET")]
|
||||
[Route("/Audio/{Id}/hls/{SegmentId}/stream.mp3", "GET")]
|
||||
[Route("/Audio/{Id}/hls/{SegmentId}/stream.aac", "GET")]
|
||||
[Api(Description = "Gets an Http live streaming segment file. Internal use only.")]
|
||||
public class GetHlsAudioSegment
|
||||
{
|
||||
|
@ -149,13 +149,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
await Task.Delay(25).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
fileText = fileText.Replace(SegmentFilePrefix, "segments/").Replace(".ts", "/stream.ts").Replace(".aac", "/stream.aac").Replace(".mp3", "/stream.mp3");
|
||||
|
||||
// It's considered live while still encoding (EVENT). Once the encoding has finished, it's video on demand (VOD).
|
||||
var playlistType = fileText.IndexOf("#EXT-X-ENDLIST", StringComparison.OrdinalIgnoreCase) == -1 ? "EVENT" : "VOD";
|
||||
|
||||
// Add event type at the top
|
||||
//fileText = fileText.Replace(allowCacheAttributeName, "#EXT-X-PLAYLIST-TYPE:" + playlistType + Environment.NewLine + allowCacheAttributeName);
|
||||
fileText = fileText.Replace(SegmentFilePrefix, "hls/").Replace(".ts", "/stream.ts").Replace(".aac", "/stream.aac").Replace(".mp3", "/stream.mp3");
|
||||
|
||||
return fileText;
|
||||
}
|
||||
@ -190,7 +184,10 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
{
|
||||
var probeSize = GetProbeSizeArgument(state.Item);
|
||||
|
||||
return string.Format("{0} {1} {2} -i {3}{4} -threads 0 {5} {6} {7} -hls_time 10 -start_number 0 -hls_list_size 1440 \"{8}\"",
|
||||
var audioOnlyPlaylistParams = string.Format(" -threads 0 -vn -codec:a:0 aac -strict experimental -ac 2 -ab 64000 -hls_time 10 -start_number 0 -hls_list_size 1440 \"{0}\"",
|
||||
"");
|
||||
|
||||
return string.Format("{0} {1} {2} -i {3}{4} -threads 0 {5} {6} {7} -hls_time 10 -start_number 0 -hls_list_size 1440 \"{8}\" {9}",
|
||||
probeSize,
|
||||
GetUserAgentParam(state.Item),
|
||||
GetFastSeekCommandLineParameter(state.Request),
|
||||
@ -199,7 +196,8 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
GetMapArgs(state),
|
||||
GetVideoArguments(state, performSubtitleConversions),
|
||||
GetAudioArguments(state),
|
||||
outputPath
|
||||
outputPath,
|
||||
audioOnlyPlaylistParams
|
||||
).Trim();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.MediaInfo;
|
||||
using MediaBrowser.Common.MediaInfo;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.IO;
|
||||
@ -24,7 +23,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
/// <summary>
|
||||
/// Class GetHlsVideoSegment
|
||||
/// </summary>
|
||||
[Route("/Videos/{Id}/segments/{SegmentId}/stream.ts", "GET")]
|
||||
[Route("/Videos/{Id}/hls/{SegmentId}/stream.ts", "GET")]
|
||||
[Api(Description = "Gets an Http live streaming segment file. Internal use only.")]
|
||||
public class GetHlsVideoSegment
|
||||
{
|
||||
|
@ -233,11 +233,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
{
|
||||
responseHeaders["Accept-Ranges"] = "none";
|
||||
|
||||
var httpClient = new HttpClient(new WebRequestHandler
|
||||
{
|
||||
CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache),
|
||||
AutomaticDecompression = DecompressionMethods.None
|
||||
});
|
||||
var httpClient = new HttpClient();
|
||||
|
||||
using (var message = new HttpRequestMessage(HttpMethod.Get, item.Path))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user