]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/peertube-player-manager.ts
Put private videos under a specific subdirectory
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / peertube-player-manager.ts
index 0d4acc3d91e576054f45cfed29baca455e61f088..533ee1bb8f8de2a11ddd8b192bc7ff0a2a176398 100644 (file)
@@ -129,6 +129,28 @@ export class PeertubePlayerManager {
           saveAverageBandwidth(data.bandwidthEstimate)
         })
 
+        const offlineNotificationElem = document.createElement('div')
+        offlineNotificationElem.classList.add('vjs-peertube-offline-notification')
+        offlineNotificationElem.innerText = player.localize('You seem to be offline and the video may not work')
+
+        const handleOnline = () => {
+          player.el().removeChild(offlineNotificationElem)
+          logger.info('The browser is online')
+        }
+
+        const handleOffline = () => {
+          player.el().appendChild(offlineNotificationElem)
+          logger.info('The browser is offline')
+        }
+
+        window.addEventListener('online', handleOnline)
+        window.addEventListener('offline', handleOffline)
+
+        player.on('dispose', () => {
+          window.removeEventListener('online', handleOnline)
+          window.removeEventListener('offline', handleOffline)
+        })
+
         return res(player)
       })
     })