diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
index 251cd4bd6d..a4acc28450 100644
--- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
@@ -135,11 +135,7 @@ namespace MediaBrowser.Api.Playback.Progressive
ApiEntryPoint.Instance.OnTranscodeBeginRequest(outputPath, TranscodingJobType.Progressive);
}
- return new ProgressiveStreamWriter
- {
- Path = outputPath,
- State = state
- };
+ return new ProgressiveStreamWriter(outputPath, state, Logger);
}
///
diff --git a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs
index e9e1340028..efab3bbc69 100644
--- a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs
+++ b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs
@@ -9,9 +9,22 @@ namespace MediaBrowser.Api.Playback.Progressive
{
public class ProgressiveStreamWriter : IStreamWriter
{
- public string Path { get; set; }
- public StreamState State { get; set; }
- public ILogger Logger { get; set; }
+ private string Path { get; set; }
+ private StreamState State { get; set; }
+ private ILogger Logger { get; set; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The path.
+ /// The state.
+ /// The logger.
+ public ProgressiveStreamWriter(string path, StreamState state, ILogger logger)
+ {
+ Path = path;
+ State = state;
+ Logger = logger;
+ }
///
/// Writes to.
@@ -38,6 +51,8 @@ namespace MediaBrowser.Api.Playback.Progressive
catch (Exception ex)
{
Logger.ErrorException("Error streaming media", ex);
+
+ throw;
}
finally
{
diff --git a/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs b/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
index 89d1ea72d5..0445cd8632 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
@@ -267,7 +267,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
}
httpListenerResponse.ContentLength64 = stream.Length;
- return new StreamWriter(stream);
+ return new StreamWriter(stream, Logger);
}
string content;
diff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
index ab178b6ea5..6f5d6e25fe 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
@@ -1,4 +1,6 @@
-using ServiceStack.Service;
+using MediaBrowser.Model.Logging;
+using ServiceStack.Service;
+using System;
using System.IO;
using System.Threading.Tasks;
@@ -9,6 +11,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
///
public class StreamWriter : IStreamWriter
{
+ private ILogger Logger { get; set; }
+
///
/// Gets or sets the source stream.
///
@@ -19,9 +23,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// Initializes a new instance of the class.
///
/// The source.
- public StreamWriter(Stream source)
+ /// The logger.
+ public StreamWriter(Stream source, ILogger logger)
{
SourceStream = source;
+ Logger = logger;
}
///
@@ -42,9 +48,18 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// Task.
private async Task WriteToAsync(Stream responseStream)
{
- using (var src = SourceStream)
+ try
{
- await src.CopyToAsync(responseStream).ConfigureAwait(false);
+ using (var src = SourceStream)
+ {
+ await src.CopyToAsync(responseStream).ConfigureAwait(false);
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.ErrorException("Error streaming media", ex);
+
+ throw;
}
}
}