From 9c89a45cb2a7bb46e68fb084723a2046b12c7617 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 16 Nov 2016 20:09:36 +0100 Subject: [PATCH] Client: add video not found message if the video... is not found --- client/src/app/app.component.scss | 4 ++++ .../app/videos/video-watch/video-watch.component.html | 5 ++++- .../app/videos/video-watch/video-watch.component.scss | 8 ++++++++ .../app/videos/video-watch/video-watch.component.ts | 10 ++++++++-- client/src/sass/application.scss | 4 ++++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/client/src/app/app.component.scss b/client/src/app/app.component.scss index 95f306d75..30d1bebde 100644 --- a/client/src/app/app.component.scss +++ b/client/src/app/app.component.scss @@ -17,3 +17,7 @@ header div { padding: 0 3px 0 3px; } } + +[hidden] { + display: none !important; +} diff --git a/client/src/app/videos/video-watch/video-watch.component.html b/client/src/app/videos/video-watch/video-watch.component.html index cb91bae7e..2dfc25f56 100644 --- a/client/src/app/videos/video-watch/video-watch.component.html +++ b/client/src/app/videos/video-watch/video-watch.component.html @@ -15,9 +15,12 @@
-
+ +
+ +
Video not found :'(
diff --git a/client/src/app/videos/video-watch/video-watch.component.scss b/client/src/app/videos/video-watch/video-watch.component.scss index fe23b849f..45446e175 100644 --- a/client/src/app/videos/video-watch/video-watch.component.scss +++ b/client/src/app/videos/video-watch/video-watch.component.scss @@ -3,6 +3,14 @@ height: 100%; } +#video-not-found { + height: 300px; + line-height: 300px; + margin-top: 50px; + text-align: center; + font-weight: bold; +} + .embed-responsive { height: 500px; } 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 0309938c0..3dab2bbb7 100644 --- a/client/src/app/videos/video-watch/video-watch.component.ts +++ b/client/src/app/videos/video-watch/video-watch.component.ts @@ -28,6 +28,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { playerElement: Element; uploadSpeed: number; video: Video = null; + videoNotFound = false; private errorTimer: NodeJS.Timer; private sub: any; @@ -51,7 +52,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.setOpenGraphTags(); this.loadVideo(); }, - error => alert(error.text) + error => { + this.videoNotFound = true; + } ); }); @@ -73,7 +76,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { console.log('Removing video from webtorrent.'); clearInterval(this.torrentInfosInterval); clearTimeout(this.errorTimer); - this.webTorrentService.remove(this.video.magnetUri); + + if (this.video !== null) { + this.webTorrentService.remove(this.video.magnetUri); + } // Remove player videojs(this.playerElement).dispose(); diff --git a/client/src/sass/application.scss b/client/src/sass/application.scss index 763e251f0..f0526e84f 100644 --- a/client/src/sass/application.scss +++ b/client/src/sass/application.scss @@ -46,6 +46,10 @@ menu { width: 200px; } +[hidden] { + display: none !important; +} + footer { border-top: 1px solid rgba(0, 0, 0, 0.2); -- 2.41.0