diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-05-30 16:55:57 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-30 16:55:57 -0400 |
| commit | 6c5fe7935b5c684526117de7472a6c34903aad44 (patch) | |
| tree | b91f6642d01828f32120650129905c6d53a328bb /MediaBrowser.Api/UserLibrary/PlaystateService.cs | |
| parent | 9f094322f7b84668c74c95e64d25e1ced70bb194 (diff) | |
| parent | d8ec7109ab5ec561254465e1664974049cc556d7 (diff) | |
Merge pull request #2675 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/PlaystateService.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/PlaystateService.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs index acbbde769..98b4a5d5d 100644 --- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs +++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs @@ -279,6 +279,20 @@ namespace MediaBrowser.Api.UserLibrary return dto; } + private PlayMethod ValidatePlayMethod(PlayMethod method, string playSessionId) + { + if (method == PlayMethod.Transcode) + { + var job = string.IsNullOrWhiteSpace(playSessionId) ? null : ApiEntryPoint.Instance.GetTranscodingJob(playSessionId); + if (job == null) + { + return PlayMethod.DirectPlay; + } + } + + return method; + } + /// <summary> /// Posts the specified request. /// </summary> @@ -300,6 +314,8 @@ namespace MediaBrowser.Api.UserLibrary public void Post(ReportPlaybackStart request) { + request.PlayMethod = ValidatePlayMethod(request.PlayMethod, request.PlaySessionId); + request.SessionId = GetSession(_sessionContext).Result.Id; var task = _sessionManager.OnPlaybackStart(request); @@ -332,6 +348,8 @@ namespace MediaBrowser.Api.UserLibrary public void Post(ReportPlaybackProgress request) { + request.PlayMethod = ValidatePlayMethod(request.PlayMethod, request.PlaySessionId); + request.SessionId = GetSession(_sessionContext).Result.Id; var task = _sessionManager.OnPlaybackProgress(request); |
