protected void NotifyResumeState(IPlayer player) { IResumablePlayer resumablePlayer = player as IResumablePlayer; if (resumablePlayer == null) { return; } // Get the current MediaItem ID at this time, later the PSC is already closed (in case of PlayerEnded state) and MediaItem information is lost. object oContext; if (!ContextVariables.TryGetValue(PlayerContext.KEY_PLAYER_CONTEXT, out oContext) || !(oContext is IPlayerContext)) { return; } IPlayerContext playerContext = (IPlayerContext)oContext; if (playerContext.CurrentMediaItem == null) { return; } IResumeState resumeState; if (resumablePlayer.GetResumeState(out resumeState)) { PlayerManagerMessaging.SendPlayerResumeStateMessage(this, playerContext.CurrentMediaItem.MediaItemId, resumeState); } }
public string ConvertVariables(string input) { var variablePatterns = input.Split('{', '}'); foreach (var pattern in variablePatterns.Where(f => !string.IsNullOrEmpty(f))) { //check for variable or if name matches action if (ContextVariables.ContainsKey(pattern)) { var variableLookup = ContextVariables[pattern]; input = input.Replace("{" + pattern + "}", variableLookup); } else { var action = CurrentConversation.Actions.Where(f => f.Name != null && f.Name.ToLower() == pattern.ToLower()).FirstOrDefault(); if (action != null) { input = input.Replace("{" + pattern + "}", action.GetDefaultValue()); } } } return(input); }
protected void NotifyResumeState(IPlayer player) { IResumablePlayer resumablePlayer = player as IResumablePlayer; if (resumablePlayer == null) { return; } // Get the current MediaItem ID at this time, later the PSC is already closed (in case of PlayerEnded state) and MediaItem information is lost. object oContext; if (!ContextVariables.TryGetValue(PlayerContext.KEY_PLAYER_CONTEXT, out oContext) || !(oContext is IPlayerContext)) { return; } IPlayerContext playerContext = (IPlayerContext)oContext; if (playerContext.CurrentMediaItem == null) { return; } try { IResumeState resumeState; if (resumablePlayer.GetResumeState(out resumeState)) { PlayerManagerMessaging.SendPlayerResumeStateMessage(this, playerContext.CurrentMediaItem, resumeState); } } catch (Exception e) { ServiceRegistration.Get <ILogger>().Warn("PlayerSlotController: Error getting resume state from player '{0}'", e, resumablePlayer); } }
public void TestContextVariables() { RegressionRunner.Run(session, ContextVariables.Executions()); }