diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-16 19:15:20 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-16 19:15:20 +0200 |
commit | 6d88de725321e77486788f64a2e2537f5e6ef0cd (patch) | |
tree | e91a165da9a434c6855f7b39663ee2d1e888909b /client/src/app/videos/+video-watch/video-watch.component.ts | |
parent | 30eac84e71eeb99e70861e5ab75c60fd39dac03c (diff) | |
download | PeerTube-6d88de725321e77486788f64a2e2537f5e6ef0cd.tar.gz PeerTube-6d88de725321e77486788f64a2e2537f5e6ef0cd.tar.zst PeerTube-6d88de725321e77486788f64a2e2537f5e6ef0cd.zip |
Correctly handle error when remote instance is down
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch.component.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index 601c6a38d..43afbae1a 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -57,6 +57,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
57 | videoHTMLDescription = '' | 57 | videoHTMLDescription = '' |
58 | likesBarTooltipText = '' | 58 | likesBarTooltipText = '' |
59 | hasAlreadyAcceptedPrivacyConcern = false | 59 | hasAlreadyAcceptedPrivacyConcern = false |
60 | remoteServerDown = false | ||
60 | 61 | ||
61 | private videojsLocaleLoaded = false | 62 | private videojsLocaleLoaded = false |
62 | private otherVideos: Video[] = [] | 63 | private otherVideos: Video[] = [] |
@@ -312,15 +313,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
312 | const errorMessage: string = typeof err === 'string' ? err : err.message | 313 | const errorMessage: string = typeof err === 'string' ? err : err.message |
313 | if (!errorMessage) return | 314 | if (!errorMessage) return |
314 | 315 | ||
315 | let message = '' | 316 | // Display a message in the video player instead of a notification |
316 | |||
317 | if (errorMessage.indexOf('http error') !== -1) { | 317 | if (errorMessage.indexOf('http error') !== -1) { |
318 | message = this.i18n('Cannot fetch video from server, maybe down.') | 318 | this.flushPlayer() |
319 | } else { | 319 | this.remoteServerDown = true |
320 | message = errorMessage | 320 | return |
321 | } | 321 | } |
322 | 322 | ||
323 | this.notificationsService.error(this.i18n('Error'), message) | 323 | this.notificationsService.error(this.i18n('Error'), errorMessage) |
324 | } | 324 | } |
325 | 325 | ||
326 | private checkUserRating () { | 326 | private checkUserRating () { |
@@ -345,6 +345,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
345 | // Re init attributes | 345 | // Re init attributes |
346 | this.descriptionLoading = false | 346 | this.descriptionLoading = false |
347 | this.completeDescriptionShown = false | 347 | this.completeDescriptionShown = false |
348 | this.remoteServerDown = false | ||
348 | 349 | ||
349 | this.updateOtherVideosDisplayed() | 350 | this.updateOtherVideosDisplayed() |
350 | 351 | ||