aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/AudioController.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-07-25 17:21:40 -0600
committercrobibero <cody@robibe.ro>2020-07-25 17:21:40 -0600
commit7bb34fc9e7e480e7048a1e15e1f463afab2198eb (patch)
tree40d411cb54b9e7ec741e84ccf5595122a495a81d /Jellyfin.Api/Controllers/AudioController.cs
parent37496e958f08d2f81976dc976b6d5de648de958f (diff)
use proper HttpClient DI
Diffstat (limited to 'Jellyfin.Api/Controllers/AudioController.cs')
-rw-r--r--Jellyfin.Api/Controllers/AudioController.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/Jellyfin.Api/Controllers/AudioController.cs b/Jellyfin.Api/Controllers/AudioController.cs
index 6e3d898bf..86577411f 100644
--- a/Jellyfin.Api/Controllers/AudioController.cs
+++ b/Jellyfin.Api/Controllers/AudioController.cs
@@ -41,7 +41,7 @@ namespace Jellyfin.Api.Controllers
private readonly IConfiguration _configuration;
private readonly IDeviceManager _deviceManager;
private readonly TranscodingJobHelper _transcodingJobHelper;
- private readonly HttpClient _httpClient;
+ private readonly IHttpClientFactory _httpClientFactory;
private readonly TranscodingJobType _transcodingJobType = TranscodingJobType.Progressive;
@@ -61,7 +61,7 @@ namespace Jellyfin.Api.Controllers
/// <param name="configuration">Instance of the <see cref="IConfiguration"/> interface.</param>
/// <param name="deviceManager">Instance of the <see cref="IDeviceManager"/> interface.</param>
/// <param name="transcodingJobHelper">The <see cref="TranscodingJobHelper"/> singleton.</param>
- /// <param name="httpClient">Instance of the <see cref="HttpClient"/>.</param>
+ /// <param name="httpClientFactory">Instance of the <see cref="IHttpClientFactory"/> interface.</param>
public AudioController(
IDlnaManager dlnaManager,
IUserManager userManger,
@@ -76,7 +76,7 @@ namespace Jellyfin.Api.Controllers
IConfiguration configuration,
IDeviceManager deviceManager,
TranscodingJobHelper transcodingJobHelper,
- HttpClient httpClient)
+ IHttpClientFactory httpClientFactory)
{
_dlnaManager = dlnaManager;
_authContext = authorizationContext;
@@ -91,7 +91,7 @@ namespace Jellyfin.Api.Controllers
_configuration = configuration;
_deviceManager = deviceManager;
_transcodingJobHelper = transcodingJobHelper;
- _httpClient = httpClient;
+ _httpClientFactory = httpClientFactory;
}
/// <summary>
@@ -295,7 +295,8 @@ namespace Jellyfin.Api.Controllers
{
StreamingHelpers.AddDlnaHeaders(state, Response.Headers, true, startTimeTicks, Request, _dlnaManager);
- return await FileStreamResponseHelpers.GetStaticRemoteStreamResult(state, isHeadRequest, this, _httpClient).ConfigureAwait(false);
+ using var httpClient = _httpClientFactory.CreateClient();
+ return await FileStreamResponseHelpers.GetStaticRemoteStreamResult(state, isHeadRequest, this, httpClient).ConfigureAwait(false);
}
if (@static.HasValue && @static.Value && state.InputProtocol != MediaProtocol.File)