using MediaBrowser.Common.Net;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Services;
namespace MediaBrowser.Api.Playback
{
///
/// Class StaticRemoteStreamWriter
///
public class StaticRemoteStreamWriter : IAsyncStreamWriter, IHasHeaders
{
///
/// The _input stream
///
private readonly HttpResponseInfo _response;
///
/// The _options
///
private readonly IDictionary _options = new Dictionary();
public StaticRemoteStreamWriter(HttpResponseInfo response)
{
_response = response;
}
///
/// Gets the options.
///
/// The options.
public IDictionary Headers
{
get { return _options; }
}
public async Task WriteToAsync(Stream responseStream, CancellationToken cancellationToken)
{
using (_response)
{
await _response.Content.CopyToAsync(responseStream, 81920, cancellationToken).ConfigureAwait(false);
}
}
}
}