diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-28 15:44:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-10-28 15:44:19 +0200 |
commit | 3f9decbd01d25f1b1805e2764dff4beae7d36c19 (patch) | |
tree | c8e71e986bada7738ef53ac5f31d2fd5449263ca /client/src/assets | |
parent | 0b8e50aa8de04ca457ea556990de5c1b330fe2ac (diff) | |
download | PeerTube-3f9decbd01d25f1b1805e2764dff4beae7d36c19.tar.gz PeerTube-3f9decbd01d25f1b1805e2764dff4beae7d36c19.tar.zst PeerTube-3f9decbd01d25f1b1805e2764dff4beae7d36c19.zip |
Prevent player crash on safari
Diffstat (limited to 'client/src/assets')
-rw-r--r-- | client/src/assets/player/peertube-player-manager.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index 533ee1bb8..5db7a2e55 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -133,13 +133,23 @@ export class PeertubePlayerManager { | |||
133 | offlineNotificationElem.classList.add('vjs-peertube-offline-notification') | 133 | offlineNotificationElem.classList.add('vjs-peertube-offline-notification') |
134 | offlineNotificationElem.innerText = player.localize('You seem to be offline and the video may not work') | 134 | offlineNotificationElem.innerText = player.localize('You seem to be offline and the video may not work') |
135 | 135 | ||
136 | let offlineNotificationElemAdded = false | ||
137 | |||
136 | const handleOnline = () => { | 138 | const handleOnline = () => { |
139 | if (!offlineNotificationElemAdded) return | ||
140 | |||
137 | player.el().removeChild(offlineNotificationElem) | 141 | player.el().removeChild(offlineNotificationElem) |
142 | offlineNotificationElemAdded = false | ||
143 | |||
138 | logger.info('The browser is online') | 144 | logger.info('The browser is online') |
139 | } | 145 | } |
140 | 146 | ||
141 | const handleOffline = () => { | 147 | const handleOffline = () => { |
148 | if (offlineNotificationElemAdded) return | ||
149 | |||
142 | player.el().appendChild(offlineNotificationElem) | 150 | player.el().appendChild(offlineNotificationElem) |
151 | offlineNotificationElemAdded = true | ||
152 | |||
143 | logger.info('The browser is offline') | 153 | logger.info('The browser is offline') |
144 | } | 154 | } |
145 | 155 | ||