aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/shared/peertube/peertube-plugin.ts
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2022-09-28 11:52:23 +0200
committerGitHub <noreply@github.com>2022-09-28 11:52:23 +0200
commitf2a16d93b476aff16d5353e4d44350298ec7e01c (patch)
tree36c43eb3299c4a1137ca38dd1a564701a5a27236 /client/src/assets/player/shared/peertube/peertube-plugin.ts
parent43972ee466740e91b16c08fe106551657969e669 (diff)
downloadPeerTube-f2a16d93b476aff16d5353e4d44350298ec7e01c.tar.gz
PeerTube-f2a16d93b476aff16d5353e4d44350298ec7e01c.tar.zst
PeerTube-f2a16d93b476aff16d5353e4d44350298ec7e01c.zip
Handle network issues in video player (#5138)
* feat(client/player): handle network offline * feat(client/player): human friendly err msg * feat(client/player): handle broken resolutions When an error occurs for a resolution, remove the resolution and try with another resolution. * fix(client/player): prevent err handl when offline * fix(client/player): localize offline text
Diffstat (limited to 'client/src/assets/player/shared/peertube/peertube-plugin.ts')
-rw-r--r--client/src/assets/player/shared/peertube/peertube-plugin.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.ts
index 83c32415e..a5d712d70 100644
--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts
+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts
@@ -125,6 +125,32 @@ class PeerTubePlugin extends Plugin {
125 } 125 }
126 126
127 displayFatalError () { 127 displayFatalError () {
128 this.player.loadingSpinner.hide()
129
130 const buildModal = (error: MediaError) => {
131 const localize = this.player.localize.bind(this.player)
132
133 const wrapper = document.createElement('div')
134 const header = document.createElement('h1')
135 header.innerText = localize('Failed to play video')
136 wrapper.appendChild(header)
137 const desc = document.createElement('div')
138 desc.innerText = localize('The video failed to play due to technical issues.')
139 wrapper.appendChild(desc)
140 const details = document.createElement('p')
141 details.classList.add('error-details')
142 details.innerText = error.message
143 wrapper.appendChild(details)
144
145 return wrapper
146 }
147
148 const modal = this.player.createModal(buildModal(this.player.error()), {
149 temporary: false,
150 uncloseable: true
151 })
152 modal.addClass('vjs-custom-error-display')
153
128 this.player.addClass('vjs-error-display-enabled') 154 this.player.addClass('vjs-error-display-enabled')
129 } 155 }
130 156