aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2022-05-29 08:49:50 -0600
committercrobibero <cody@robibe.ro>2022-06-06 09:16:11 -0400
commitb8722d02a37a9c1141ea7ca3391fbe795ff1bc5a (patch)
tree69f6804247eaba2e5bc420f6712fe2911df1e6ab
parentad1e554141b26b36f4fac987f011ce0d7c9b73dd (diff)
Merge pull request #7781 from crobibero/live-tv-infinite
(cherry picked from commit 77c73e241fe1705528e3ffbb42f074c46240b9fb) Signed-off-by: crobibero <cody@robibe.ro>
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs7
-rw-r--r--Emby.Server.Implementations/Session/WebSocketController.cs4
-rw-r--r--MediaBrowser.Controller/Session/ISessionManager.cs2
-rw-r--r--MediaBrowser.Model/Session/PlayerStateInfo.cs6
4 files changed, 15 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index d08fedd11..d25376297 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -329,13 +329,17 @@ namespace Emby.Server.Implementations.Session
}
/// <inheritdoc />
- public void CloseIfNeeded(SessionInfo session)
+ public async Task CloseIfNeededAsync(SessionInfo session)
{
if (!session.SessionControllers.Any(i => i.IsSessionActive))
{
var key = GetSessionKey(session.Client, session.DeviceId);
_activeConnections.TryRemove(key, out _);
+ if (!string.IsNullOrEmpty(session.PlayState?.LiveStreamId))
+ {
+ await _mediaSourceManager.CloseLiveStream(session.PlayState.LiveStreamId).ConfigureAwait(false);
+ }
OnSessionEnded(session);
}
@@ -413,6 +417,7 @@ namespace Emby.Server.Implementations.Session
session.PlayState.IsPaused = info.IsPaused;
session.PlayState.PositionTicks = info.PositionTicks;
session.PlayState.MediaSourceId = info.MediaSourceId;
+ session.PlayState.LiveStreamId = info.LiveStreamId;
session.PlayState.CanSeek = info.CanSeek;
session.PlayState.IsMuted = info.IsMuted;
session.PlayState.VolumeLevel = info.VolumeLevel;
diff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs
index 9fa92a53a..d21b6a929 100644
--- a/Emby.Server.Implementations/Session/WebSocketController.cs
+++ b/Emby.Server.Implementations/Session/WebSocketController.cs
@@ -53,13 +53,13 @@ namespace Emby.Server.Implementations.Session
connection.Closed += OnConnectionClosed;
}
- private void OnConnectionClosed(object? sender, EventArgs e)
+ private async void OnConnectionClosed(object? sender, EventArgs e)
{
var connection = sender as IWebSocketConnection ?? throw new ArgumentException($"{nameof(sender)} is not of type {nameof(IWebSocketConnection)}", nameof(sender));
_logger.LogDebug("Removing websocket from session {Session}", _session.Id);
_sockets.Remove(connection);
connection.Closed -= OnConnectionClosed;
- _sessionManager.CloseIfNeeded(_session);
+ await _sessionManager.CloseIfNeededAsync(_session).ConfigureAwait(false);
}
/// <inheritdoc />
diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs
index c86556095..b16399598 100644
--- a/MediaBrowser.Controller/Session/ISessionManager.cs
+++ b/MediaBrowser.Controller/Session/ISessionManager.cs
@@ -352,6 +352,6 @@ namespace MediaBrowser.Controller.Session
/// <returns>Task.</returns>
Task RevokeUserTokens(Guid userId, string currentAccessToken);
- void CloseIfNeeded(SessionInfo session);
+ Task CloseIfNeededAsync(SessionInfo session);
}
}
diff --git a/MediaBrowser.Model/Session/PlayerStateInfo.cs b/MediaBrowser.Model/Session/PlayerStateInfo.cs
index 0f10605ea..80e6d4e0b 100644
--- a/MediaBrowser.Model/Session/PlayerStateInfo.cs
+++ b/MediaBrowser.Model/Session/PlayerStateInfo.cs
@@ -64,5 +64,11 @@ namespace MediaBrowser.Model.Session
/// </summary>
/// <value>The repeat mode.</value>
public RepeatMode RepeatMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the now playing live stream identifier.
+ /// </summary>
+ /// <value>The live stream identifier.</value>
+ public string LiveStreamId { get; set; }
}
}