From e8634cbafd2c8014f47ad2d6d2d2e62b3a2f4041 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 19 Jun 2013 08:23:59 -0400 Subject: [PATCH] fixed hls file deletion --- MediaBrowser.Api/Playback/Hls/VideoHlsService.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index df74d3688a..a88365c195 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -1,5 +1,6 @@ using System.IO; using System.Linq; +using System.Threading.Tasks; using MediaBrowser.Common.IO; using MediaBrowser.Common.MediaInfo; using MediaBrowser.Controller; @@ -67,6 +68,15 @@ namespace MediaBrowser.Api.Playback.Hls foreach (var playlist in Directory.EnumerateFiles(ApplicationPaths.EncodedMediaCachePath, "*.m3u8").ToList()) { ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlist, TranscodingJobType.Hls); + + // Avoid implicitly captured closure + var playlist1 = playlist; + + Task.Run(async () => + { + await Task.Delay(2000).ConfigureAwait(false); + ApiEntryPoint.Instance.OnTranscodeEndRequest(playlist1, TranscodingJobType.Hls); + }); } var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(RequestContext.PathInfo);