Prevent player crash on safari
This commit is contained in:
parent
0b8e50aa8d
commit
3f9decbd01
|
@ -133,13 +133,23 @@ export class PeertubePlayerManager {
|
||||||
offlineNotificationElem.classList.add('vjs-peertube-offline-notification')
|
offlineNotificationElem.classList.add('vjs-peertube-offline-notification')
|
||||||
offlineNotificationElem.innerText = player.localize('You seem to be offline and the video may not work')
|
offlineNotificationElem.innerText = player.localize('You seem to be offline and the video may not work')
|
||||||
|
|
||||||
|
let offlineNotificationElemAdded = false
|
||||||
|
|
||||||
const handleOnline = () => {
|
const handleOnline = () => {
|
||||||
|
if (!offlineNotificationElemAdded) return
|
||||||
|
|
||||||
player.el().removeChild(offlineNotificationElem)
|
player.el().removeChild(offlineNotificationElem)
|
||||||
|
offlineNotificationElemAdded = false
|
||||||
|
|
||||||
logger.info('The browser is online')
|
logger.info('The browser is online')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleOffline = () => {
|
const handleOffline = () => {
|
||||||
|
if (offlineNotificationElemAdded) return
|
||||||
|
|
||||||
player.el().appendChild(offlineNotificationElem)
|
player.el().appendChild(offlineNotificationElem)
|
||||||
|
offlineNotificationElemAdded = true
|
||||||
|
|
||||||
logger.info('The browser is offline')
|
logger.info('The browser is offline')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue