diff options
Diffstat (limited to 'MediaBrowser.Api/Playback/BaseStreamingService.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/BaseStreamingService.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 1ce7d2db3..f6872acd2 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -864,7 +864,7 @@ namespace MediaBrowser.Api.Playback /// </summary> /// <param name="process">The process.</param> /// <param name="state">The state.</param> - protected void OnFfMpegProcessExited(Process process, StreamState state) + protected async void OnFfMpegProcessExited(Process process, StreamState state) { if (state.IsoMount != null) { @@ -889,6 +889,18 @@ namespace MediaBrowser.Api.Playback { Logger.Info("FFMpeg exited with an error for {0}", outputFilePath); } + + if (!string.IsNullOrEmpty(state.LiveTvStreamId)) + { + try + { + await LiveTvManager.CloseLiveStream(state.LiveTvStreamId, CancellationToken.None).ConfigureAwait(false); + } + catch (Exception ex) + { + Logger.ErrorException("Error closing live tv stream", ex); + } + } } /// <summary> @@ -936,6 +948,8 @@ namespace MediaBrowser.Api.Playback { var streamInfo = await LiveTvManager.GetRecordingStream(request.Id, cancellationToken).ConfigureAwait(false); + state.LiveTvStreamId = streamInfo.Id; + if (!string.IsNullOrEmpty(streamInfo.Path) && File.Exists(streamInfo.Path)) { state.MediaPath = streamInfo.Path; @@ -961,6 +975,8 @@ namespace MediaBrowser.Api.Playback var streamInfo = await LiveTvManager.GetChannelStream(request.Id, cancellationToken).ConfigureAwait(false); + state.LiveTvStreamId = streamInfo.Id; + if (!string.IsNullOrEmpty(streamInfo.Path) && File.Exists(streamInfo.Path)) { state.MediaPath = streamInfo.Path; |
