aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Controller/Session/ISessionController.cs16
-rw-r--r--MediaBrowser.Dlna/PlayTo/DlnaController.cs10
-rw-r--r--MediaBrowser.Model/Entities/BaseItemInfo.cs6
-rw-r--r--MediaBrowser.Model/Session/GeneralCommand.cs3
-rw-r--r--MediaBrowser.Model/Session/PlaystateCommand.cs4
-rw-r--r--MediaBrowser.Server.Implementations/Roku/RokuSessionController.cs10
-rw-r--r--MediaBrowser.Server.Implementations/Session/SessionManager.cs52
-rw-r--r--MediaBrowser.Server.Implementations/Session/WebSocketController.cs24
8 files changed, 119 insertions, 6 deletions
diff --git a/MediaBrowser.Controller/Session/ISessionController.cs b/MediaBrowser.Controller/Session/ISessionController.cs
index 1d5fbf359..170b50bf5 100644
--- a/MediaBrowser.Controller/Session/ISessionController.cs
+++ b/MediaBrowser.Controller/Session/ISessionController.cs
@@ -96,6 +96,22 @@ namespace MediaBrowser.Controller.Session
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendSessionEndedNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the playback start notification.
+ /// </summary>
+ /// <param name="sessionInfo">The session information.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendPlaybackStartNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the playback start notification.
+ /// </summary>
+ /// <param name="sessionInfo">The session information.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendPlaybackStoppedNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken);
/// <summary>
/// Sends the server restart notification.
diff --git a/MediaBrowser.Dlna/PlayTo/DlnaController.cs b/MediaBrowser.Dlna/PlayTo/DlnaController.cs
index 6edb9d6f6..596081a5e 100644
--- a/MediaBrowser.Dlna/PlayTo/DlnaController.cs
+++ b/MediaBrowser.Dlna/PlayTo/DlnaController.cs
@@ -331,6 +331,16 @@ namespace MediaBrowser.Dlna.PlayTo
return Task.FromResult(true);
}
+ public Task SendPlaybackStartNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken)
+ {
+ return Task.FromResult(true);
+ }
+
+ public Task SendPlaybackStoppedNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken)
+ {
+ return Task.FromResult(true);
+ }
+
public Task SendServerShutdownNotification(CancellationToken cancellationToken)
{
return Task.FromResult(true);
diff --git a/MediaBrowser.Model/Entities/BaseItemInfo.cs b/MediaBrowser.Model/Entities/BaseItemInfo.cs
index 16a08d693..824f8dc03 100644
--- a/MediaBrowser.Model/Entities/BaseItemInfo.cs
+++ b/MediaBrowser.Model/Entities/BaseItemInfo.cs
@@ -47,6 +47,12 @@ namespace MediaBrowser.Model.Entities
public Guid? PrimaryImageTag { get; set; }
/// <summary>
+ /// Gets or sets the primary image item identifier.
+ /// </summary>
+ /// <value>The primary image item identifier.</value>
+ public string PrimaryImageItemId { get; set; }
+
+ /// <summary>
/// Gets or sets the thumb image tag.
/// </summary>
/// <value>The thumb image tag.</value>
diff --git a/MediaBrowser.Model/Session/GeneralCommand.cs b/MediaBrowser.Model/Session/GeneralCommand.cs
index a50c3b5fe..4202ec456 100644
--- a/MediaBrowser.Model/Session/GeneralCommand.cs
+++ b/MediaBrowser.Model/Session/GeneralCommand.cs
@@ -46,6 +46,7 @@ namespace MediaBrowser.Model.Session
ToggleMute = 21,
SetVolume = 22,
SetAudioStreamIndex = 23,
- SetSubtitleStreamIndex = 24
+ SetSubtitleStreamIndex = 24,
+ ToggleFullscreen = 25
}
}
diff --git a/MediaBrowser.Model/Session/PlaystateCommand.cs b/MediaBrowser.Model/Session/PlaystateCommand.cs
index 91572ba62..6466c6485 100644
--- a/MediaBrowser.Model/Session/PlaystateCommand.cs
+++ b/MediaBrowser.Model/Session/PlaystateCommand.cs
@@ -31,10 +31,6 @@ namespace MediaBrowser.Model.Session
/// </summary>
Seek,
/// <summary>
- /// The fullscreen
- /// </summary>
- Fullscreen,
- /// <summary>
/// The rewind
/// </summary>
Rewind,
diff --git a/MediaBrowser.Server.Implementations/Roku/RokuSessionController.cs b/MediaBrowser.Server.Implementations/Roku/RokuSessionController.cs
index 5a4522bd3..307619cbe 100644
--- a/MediaBrowser.Server.Implementations/Roku/RokuSessionController.cs
+++ b/MediaBrowser.Server.Implementations/Roku/RokuSessionController.cs
@@ -46,6 +46,16 @@ namespace MediaBrowser.Server.Implementations.Roku
return Task.FromResult(true);
}
+ public Task SendPlaybackStartNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken)
+ {
+ return Task.FromResult(true);
+ }
+
+ public Task SendPlaybackStoppedNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken)
+ {
+ return Task.FromResult(true);
+ }
+
public Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken)
{
return SendCommand(new WebSocketMessage<MessageCommand>
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
index 6452d5ac7..53d1e6436 100644
--- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs
+++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
@@ -444,6 +444,8 @@ namespace MediaBrowser.Server.Implementations.Session
MediaSourceId = info.MediaSourceId
}, _logger);
+
+ await SendPlaybackStartNotification(session, CancellationToken.None).ConfigureAwait(false);
}
/// <summary>
@@ -583,6 +585,8 @@ namespace MediaBrowser.Server.Implementations.Session
MediaSourceId = mediaSourceId
}, _logger);
+
+ await SendPlaybackStoppedNotification(session, CancellationToken.None).ConfigureAwait(false);
}
private string GetMediaSourceId(BaseItem item, string reportedMediaSourceId)
@@ -972,7 +976,6 @@ namespace MediaBrowser.Server.Implementations.Session
return Task.WhenAll(tasks);
}
-
public Task SendSessionEndedNotification(SessionInfo sessionInfo, CancellationToken cancellationToken)
{
var sessions = Sessions.Where(i => i.IsActive && i.SessionController != null).ToList();
@@ -994,6 +997,48 @@ namespace MediaBrowser.Server.Implementations.Session
return Task.WhenAll(tasks);
}
+ public Task SendPlaybackStartNotification(SessionInfo sessionInfo, CancellationToken cancellationToken)
+ {
+ var sessions = Sessions.Where(i => i.IsActive && i.SessionController != null).ToList();
+ var dto = GetSessionInfoDto(sessionInfo);
+
+ var tasks = sessions.Select(session => Task.Run(async () =>
+ {
+ try
+ {
+ await session.SessionController.SendPlaybackStartNotification(dto, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error in SendPlaybackStartNotification.", ex);
+ }
+
+ }, cancellationToken));
+
+ return Task.WhenAll(tasks);
+ }
+
+ public Task SendPlaybackStoppedNotification(SessionInfo sessionInfo, CancellationToken cancellationToken)
+ {
+ var sessions = Sessions.Where(i => i.IsActive && i.SessionController != null).ToList();
+ var dto = GetSessionInfoDto(sessionInfo);
+
+ var tasks = sessions.Select(session => Task.Run(async () =>
+ {
+ try
+ {
+ await session.SessionController.SendPlaybackStoppedNotification(dto, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error in SendPlaybackStoppedNotification.", ex);
+ }
+
+ }, cancellationToken));
+
+ return Task.WhenAll(tasks);
+ }
+
/// <summary>
/// Adds the additional user.
/// </summary>
@@ -1163,6 +1208,11 @@ namespace MediaBrowser.Server.Implementations.Session
info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);
+ if (info.PrimaryImageTag.HasValue)
+ {
+ info.PrimaryImageItemId = GetDtoId(item);
+ }
+
var backropItem = item.HasImage(ImageType.Backdrop) ? item : null;
var thumbItem = item.HasImage(ImageType.Thumb) ? item : null;
diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs
index 17a3594d8..2f547340e 100644
--- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs
+++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs
@@ -210,5 +210,29 @@ namespace MediaBrowser.Server.Implementations.Session
}, cancellationToken);
}
+
+ public Task SendPlaybackStartNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken)
+ {
+ var socket = GetActiveSocket();
+
+ return socket.SendAsync(new WebSocketMessage<SessionInfoDto>
+ {
+ MessageType = "PlaybackStart",
+ Data = sessionInfo
+
+ }, cancellationToken);
+ }
+
+ public Task SendPlaybackStoppedNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken)
+ {
+ var socket = GetActiveSocket();
+
+ return socket.SendAsync(new WebSocketMessage<SessionInfoDto>
+ {
+ MessageType = "PlaybackStopped",
+ Data = sessionInfo
+
+ }, cancellationToken);
+ }
}
}