mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
3.0.5231.40980
This commit is contained in:
parent
ee5eefb01e
commit
8a5cd4b491
13 changed files with 68 additions and 42 deletions
|
@ -167,16 +167,20 @@
|
|||
return deferred.promise();
|
||||
};
|
||||
|
||||
function subscribeToPlayerUpdates() {
|
||||
self.subscribeToPlayerUpdates = function () {
|
||||
|
||||
self.isUpdating = true;
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
|
||||
ApiClient.sendWebSocketMessage("SessionsStart", "100,700");
|
||||
ApiClient.sendWebSocketMessage("SessionsStart", "100,900");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function unsubscribeFromPlayerUpdates() {
|
||||
|
||||
self.false = true;
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
|
||||
ApiClient.sendWebSocketMessage("SessionsStop");
|
||||
|
@ -190,7 +194,7 @@
|
|||
|
||||
playerListenerCount = 0;
|
||||
|
||||
subscribeToPlayerUpdates();
|
||||
self.subscribeToPlayerUpdates();
|
||||
}
|
||||
|
||||
playerListenerCount++;
|
||||
|
@ -259,6 +263,14 @@
|
|||
$(player).trigger(name, [getPlayerState(session)]);
|
||||
}
|
||||
|
||||
function onWebSocketConnectionChange() {
|
||||
|
||||
// Reconnect
|
||||
if (player.isUpdating) {
|
||||
player.subscribeToPlayerUpdates();
|
||||
}
|
||||
}
|
||||
|
||||
function onWebSocketMessageReceived(e, msg) {
|
||||
|
||||
if (msg.MessageType === "Sessions") {
|
||||
|
@ -291,6 +303,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(ApiClient).on("websocketmessage", onWebSocketMessageReceived);
|
||||
$(ApiClient).on("websocketmessage", onWebSocketMessageReceived).on("websocketopen", onWebSocketConnectionChange);
|
||||
|
||||
})(window, document, jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue