diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-25 13:52:36 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-25 13:52:36 -0400 |
| commit | d9108f69f35080acb5ebefaefcd469595529afa2 (patch) | |
| tree | 3f04e719877b9cdec9529ca34406b753f6492abc /MediaBrowser.Api/ApiEntryPoint.cs | |
| parent | d6832e7a41c2a24f7dd998284e8e4f6eacf1d188 (diff) | |
| parent | 72fe76ab1008f0bd38157cc37cde45797b5f6417 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/Emby
Diffstat (limited to 'MediaBrowser.Api/ApiEntryPoint.cs')
| -rw-r--r-- | MediaBrowser.Api/ApiEntryPoint.cs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 55f191f1a..117ff2305 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -63,6 +63,15 @@ namespace MediaBrowser.Api _mediaSourceManager = mediaSourceManager; Instance = this; + _sessionManager.PlaybackProgress += _sessionManager_PlaybackProgress; + } + + void _sessionManager_PlaybackProgress(object sender, PlaybackProgressEventArgs e) + { + if (!string.IsNullOrWhiteSpace(e.PlaySessionId)) + { + PingTranscodingJob(e.PlaySessionId, e.IsPaused); + } } /// <summary> @@ -300,26 +309,31 @@ namespace MediaBrowser.Api PingTimer(job, false); } } - internal void PingTranscodingJob(string playSessionId) + internal void PingTranscodingJob(string playSessionId, bool? isUserPaused) { if (string.IsNullOrEmpty(playSessionId)) { throw new ArgumentNullException("playSessionId"); } - //Logger.Debug("PingTranscodingJob PlaySessionId={0}", playSessionId); + //Logger.Debug("PingTranscodingJob PlaySessionId={0} isUsedPaused: {1}", playSessionId, isUserPaused); - var jobs = new List<TranscodingJob>(); + List<TranscodingJob> jobs; lock (_activeTranscodingJobs) { // This is really only needed for HLS. // Progressive streams can stop on their own reliably - jobs = jobs.Where(j => string.Equals(playSessionId, j.PlaySessionId, StringComparison.OrdinalIgnoreCase)).ToList(); + jobs = _activeTranscodingJobs.Where(j => string.Equals(playSessionId, j.PlaySessionId, StringComparison.OrdinalIgnoreCase)).ToList(); } foreach (var job in jobs) { + if (isUserPaused.HasValue) + { + //Logger.Debug("Setting job.IsUserPaused to {0}. jobId: {1}", isUserPaused, job.Id); + job.IsUserPaused = isUserPaused.Value; + } PingTimer(job, true); } } @@ -655,6 +669,7 @@ namespace MediaBrowser.Api public object ProcessLock = new object(); public bool HasExited { get; set; } + public bool IsUserPaused { get; set; } public string Id { get; set; } |
