aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-02-13 11:38:43 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-02-13 11:38:43 -0500
commitbe1ce0f80275a1718dc89dd65e2919e9eab8eb7b (patch)
tree68dc8095701f4b8c45a073c46f4097827e6627c3 /MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs
parenteec9e0482525c400e9dc7cb17bc000434adba105 (diff)
convert static remote streaming to use internal interfaces
Diffstat (limited to 'MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs')
-rw-r--r--MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs26
1 files changed, 7 insertions, 19 deletions
diff --git a/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs b/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs
index 7820a26d8..24dce64df 100644
--- a/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs
+++ b/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs
@@ -1,7 +1,7 @@
-using ServiceStack.Web;
+using MediaBrowser.Common.Net;
+using ServiceStack.Web;
using System.Collections.Generic;
using System.IO;
-using System.Net.Http;
using System.Threading.Tasks;
namespace MediaBrowser.Api.Playback
@@ -14,22 +14,16 @@ namespace MediaBrowser.Api.Playback
/// <summary>
/// The _input stream
/// </summary>
- private readonly HttpResponseMessage _msg;
-
- private readonly HttpClient _client;
+ private readonly HttpResponseInfo _response;
/// <summary>
/// The _options
/// </summary>
private readonly IDictionary<string, string> _options = new Dictionary<string, string>();
- /// <summary>
- /// Initializes a new instance of the <see cref="StaticRemoteStreamWriter"/> class.
- /// </summary>
- public StaticRemoteStreamWriter(HttpResponseMessage msg, HttpClient client)
+ public StaticRemoteStreamWriter(HttpResponseInfo response)
{
- _msg = msg;
- _client = client;
+ _response = response;
}
/// <summary>
@@ -59,15 +53,9 @@ namespace MediaBrowser.Api.Playback
/// <returns>Task.</returns>
public async Task WriteToAsync(Stream responseStream)
{
- using (_client)
+ using (var remoteStream = _response.Content)
{
- using (_msg)
- {
- using (var remoteStream = await _msg.Content.ReadAsStreamAsync().ConfigureAwait(false))
- {
- await remoteStream.CopyToAsync(responseStream, 819200).ConfigureAwait(false);
- }
- }
+ await remoteStream.CopyToAsync(responseStream, 819200).ConfigureAwait(false);
}
}
}