public async Task <ActionResult> OnPlaybackStopped( [FromRoute, Required] Guid userId, [FromRoute, Required] Guid itemId, [FromQuery] string?mediaSourceId, [FromQuery] string?nextMediaType, [FromQuery] long?positionTicks, [FromQuery] string?liveStreamId, [FromQuery] string?playSessionId) { var playbackStopInfo = new PlaybackStopInfo { ItemId = itemId, PositionTicks = positionTicks, MediaSourceId = mediaSourceId, PlaySessionId = playSessionId, LiveStreamId = liveStreamId, NextMediaType = nextMediaType }; _logger.LogDebug("ReportPlaybackStopped PlaySessionId: {0}", playbackStopInfo.PlaySessionId ?? string.Empty); if (!string.IsNullOrWhiteSpace(playbackStopInfo.PlaySessionId)) { var authInfo = await _authContext.GetAuthorizationInfo(Request).ConfigureAwait(false); await _transcodingJobHelper.KillTranscodingJobs(authInfo.DeviceId, playbackStopInfo.PlaySessionId, s => true).ConfigureAwait(false); } playbackStopInfo.SessionId = await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false); await _sessionManager.OnPlaybackStopped(playbackStopInfo).ConfigureAwait(false); return(NoContent()); }
public async Task <ActionResult> OnPlaybackStart( [FromRoute, Required] Guid userId, [FromRoute, Required] Guid itemId, [FromQuery] string?mediaSourceId, [FromQuery] int?audioStreamIndex, [FromQuery] int?subtitleStreamIndex, [FromQuery] PlayMethod?playMethod, [FromQuery] string?liveStreamId, [FromQuery] string?playSessionId, [FromQuery] bool canSeek = false) { var playbackStartInfo = new PlaybackStartInfo { CanSeek = canSeek, ItemId = itemId, MediaSourceId = mediaSourceId, AudioStreamIndex = audioStreamIndex, SubtitleStreamIndex = subtitleStreamIndex, PlayMethod = playMethod ?? PlayMethod.Transcode, PlaySessionId = playSessionId, LiveStreamId = liveStreamId }; playbackStartInfo.PlayMethod = ValidatePlayMethod(playbackStartInfo.PlayMethod, playbackStartInfo.PlaySessionId); playbackStartInfo.SessionId = await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false); await _sessionManager.OnPlaybackStart(playbackStartInfo).ConfigureAwait(false); return(NoContent()); }
public async Task <ActionResult> Play( [FromRoute, Required] string sessionId, [FromQuery, Required] PlayCommand playCommand, [FromQuery, Required, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] itemIds, [FromQuery] long?startPositionTicks, [FromQuery] string?mediaSourceId, [FromQuery] int?audioStreamIndex, [FromQuery] int?subtitleStreamIndex, [FromQuery] int?startIndex) { var playRequest = new PlayRequest { ItemIds = itemIds, StartPositionTicks = startPositionTicks, PlayCommand = playCommand, MediaSourceId = mediaSourceId, AudioStreamIndex = audioStreamIndex, SubtitleStreamIndex = subtitleStreamIndex, StartIndex = startIndex }; await _sessionManager.SendPlayCommand( await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false), sessionId, playRequest, CancellationToken.None) .ConfigureAwait(false); return(NoContent()); }
public async Task <ActionResult> ReportPlaybackProgress([FromBody] PlaybackProgressInfo playbackProgressInfo) { playbackProgressInfo.PlayMethod = ValidatePlayMethod(playbackProgressInfo.PlayMethod, playbackProgressInfo.PlaySessionId); playbackProgressInfo.SessionId = await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false); await _sessionManager.OnPlaybackProgress(playbackProgressInfo).ConfigureAwait(false); return(NoContent()); }
public async Task <ActionResult> ReportViewing( [FromQuery] string?sessionId, [FromQuery, Required] string?itemId) { string session = sessionId ?? await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false); _sessionManager.ReportNowViewingItem(session, itemId); return(NoContent()); }
public async Task <ActionResult> PostFullCapabilities( [FromQuery] string?id, [FromBody, Required] ClientCapabilitiesDto capabilities) { if (string.IsNullOrWhiteSpace(id)) { id = await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false); } _sessionManager.ReportCapabilities(id, capabilities.ToClientCapabilities()); return(NoContent()); }
public async Task <ActionResult> ReportPlaybackStopped([FromBody] PlaybackStopInfo playbackStopInfo) { _logger.LogDebug("ReportPlaybackStopped PlaySessionId: {0}", playbackStopInfo.PlaySessionId ?? string.Empty); if (!string.IsNullOrWhiteSpace(playbackStopInfo.PlaySessionId)) { var authInfo = await _authContext.GetAuthorizationInfo(Request).ConfigureAwait(false); await _transcodingJobHelper.KillTranscodingJobs(authInfo.DeviceId, playbackStopInfo.PlaySessionId, s => true).ConfigureAwait(false); } playbackStopInfo.SessionId = await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false); await _sessionManager.OnPlaybackStopped(playbackStopInfo).ConfigureAwait(false); return(NoContent()); }
public async Task <ActionResult> SendMessageCommand( [FromRoute, Required] string sessionId, [FromBody, Required] MessageCommand command) { if (string.IsNullOrWhiteSpace(command.Header)) { command.Header = "Message from Server"; } await _sessionManager.SendMessageCommand( await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false), sessionId, command, CancellationToken.None) .ConfigureAwait(false); return(NoContent()); }
public async Task <ActionResult> SendPlaystateCommand( [FromRoute, Required] string sessionId, [FromRoute, Required] PlaystateCommand command, [FromQuery] long?seekPositionTicks, [FromQuery] string?controllingUserId) { await _sessionManager.SendPlaystateCommand( await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false), sessionId, new PlaystateRequest() { Command = command, ControllingUserId = controllingUserId, SeekPositionTicks = seekPositionTicks, }, CancellationToken.None) .ConfigureAwait(false); return(NoContent()); }
public async Task <ActionResult> DisplayContent( [FromRoute, Required] string sessionId, [FromQuery, Required] string itemType, [FromQuery, Required] string itemId, [FromQuery, Required] string itemName) { var command = new BrowseRequest { ItemId = itemId, ItemName = itemName, ItemType = itemType }; await _sessionManager.SendBrowseCommand( await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false), sessionId, command, CancellationToken.None) .ConfigureAwait(false); return(NoContent()); }
public async Task <ActionResult> OnPlaybackProgress( [FromRoute, Required] Guid userId, [FromRoute, Required] Guid itemId, [FromQuery] string?mediaSourceId, [FromQuery] long?positionTicks, [FromQuery] int?audioStreamIndex, [FromQuery] int?subtitleStreamIndex, [FromQuery] int?volumeLevel, [FromQuery] PlayMethod?playMethod, [FromQuery] string?liveStreamId, [FromQuery] string?playSessionId, [FromQuery] RepeatMode?repeatMode, [FromQuery] bool isPaused = false, [FromQuery] bool isMuted = false) { var playbackProgressInfo = new PlaybackProgressInfo { ItemId = itemId, PositionTicks = positionTicks, IsMuted = isMuted, IsPaused = isPaused, MediaSourceId = mediaSourceId, AudioStreamIndex = audioStreamIndex, SubtitleStreamIndex = subtitleStreamIndex, VolumeLevel = volumeLevel, PlayMethod = playMethod ?? PlayMethod.Transcode, PlaySessionId = playSessionId, LiveStreamId = liveStreamId, RepeatMode = repeatMode ?? RepeatMode.RepeatNone }; playbackProgressInfo.PlayMethod = ValidatePlayMethod(playbackProgressInfo.PlayMethod, playbackProgressInfo.PlaySessionId); playbackProgressInfo.SessionId = await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false); await _sessionManager.OnPlaybackProgress(playbackProgressInfo).ConfigureAwait(false); return(NoContent()); }
public async Task <ActionResult> PostCapabilities( [FromQuery] string?id, [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] playableMediaTypes, [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] GeneralCommandType[] supportedCommands, [FromQuery] bool supportsMediaControl = false, [FromQuery] bool supportsSync = false, [FromQuery] bool supportsPersistentIdentifier = true) { if (string.IsNullOrWhiteSpace(id)) { id = await RequestHelpers.GetSessionId(_sessionManager, _authContext, Request).ConfigureAwait(false); } _sessionManager.ReportCapabilities(id, new ClientCapabilities { PlayableMediaTypes = playableMediaTypes, SupportedCommands = supportedCommands, SupportsMediaControl = supportsMediaControl, SupportsSync = supportsSync, SupportsPersistentIdentifier = supportsPersistentIdentifier }); return(NoContent()); }