diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-11-16 20:09:36 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-11-16 20:29:26 +0100 |
commit | 9c89a45cb2a7bb46e68fb084723a2046b12c7617 (patch) | |
tree | 8524b4bd6444856dc5cbc6194c38d00efa27fc36 | |
parent | 73ce7f96762de2238ff998cf1896df6e5cbf0973 (diff) | |
download | PeerTube-9c89a45cb2a7bb46e68fb084723a2046b12c7617.tar.gz PeerTube-9c89a45cb2a7bb46e68fb084723a2046b12c7617.tar.zst PeerTube-9c89a45cb2a7bb46e68fb084723a2046b12c7617.zip |
Client: add video not found message if the video... is not found
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 { | |||
17 | padding: 0 3px 0 3px; | 17 | padding: 0 3px 0 3px; |
18 | } | 18 | } |
19 | } | 19 | } |
20 | |||
21 | [hidden] { | ||
22 | display: none !important; | ||
23 | } | ||
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 @@ | |||
15 | 15 | ||
16 | <div class="row"> | 16 | <div class="row"> |
17 | <div class="col-md-12"> | 17 | <div class="col-md-12"> |
18 | <div class="embed-responsive embed-responsive-19by9"> | 18 | <!-- We need the video container for videojs so we just hide it --> |
19 | <div [hidden]="videoNotFound" class="embed-responsive embed-responsive-19by9"> | ||
19 | <video id="video-container" class="video-js vjs-default-skin vjs-big-play-centered"></video> | 20 | <video id="video-container" class="video-js vjs-default-skin vjs-big-play-centered"></video> |
20 | </div> | 21 | </div> |
22 | |||
23 | <div *ngIf="videoNotFound" id="video-not-found">Video not found :'(</div> | ||
21 | </div> | 24 | </div> |
22 | </div> | 25 | </div> |
23 | 26 | ||
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 @@ | |||
3 | height: 100%; | 3 | height: 100%; |
4 | } | 4 | } |
5 | 5 | ||
6 | #video-not-found { | ||
7 | height: 300px; | ||
8 | line-height: 300px; | ||
9 | margin-top: 50px; | ||
10 | text-align: center; | ||
11 | font-weight: bold; | ||
12 | } | ||
13 | |||
6 | .embed-responsive { | 14 | .embed-responsive { |
7 | height: 500px; | 15 | height: 500px; |
8 | } | 16 | } |
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 { | |||
28 | playerElement: Element; | 28 | playerElement: Element; |
29 | uploadSpeed: number; | 29 | uploadSpeed: number; |
30 | video: Video = null; | 30 | video: Video = null; |
31 | videoNotFound = false; | ||
31 | 32 | ||
32 | private errorTimer: NodeJS.Timer; | 33 | private errorTimer: NodeJS.Timer; |
33 | private sub: any; | 34 | private sub: any; |
@@ -51,7 +52,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
51 | this.setOpenGraphTags(); | 52 | this.setOpenGraphTags(); |
52 | this.loadVideo(); | 53 | this.loadVideo(); |
53 | }, | 54 | }, |
54 | error => alert(error.text) | 55 | error => { |
56 | this.videoNotFound = true; | ||
57 | } | ||
55 | ); | 58 | ); |
56 | }); | 59 | }); |
57 | 60 | ||
@@ -73,7 +76,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
73 | console.log('Removing video from webtorrent.'); | 76 | console.log('Removing video from webtorrent.'); |
74 | clearInterval(this.torrentInfosInterval); | 77 | clearInterval(this.torrentInfosInterval); |
75 | clearTimeout(this.errorTimer); | 78 | clearTimeout(this.errorTimer); |
76 | this.webTorrentService.remove(this.video.magnetUri); | 79 | |
80 | if (this.video !== null) { | ||
81 | this.webTorrentService.remove(this.video.magnetUri); | ||
82 | } | ||
77 | 83 | ||
78 | // Remove player | 84 | // Remove player |
79 | videojs(this.playerElement).dispose(); | 85 | 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 { | |||
46 | width: 200px; | 46 | width: 200px; |
47 | } | 47 | } |
48 | 48 | ||
49 | [hidden] { | ||
50 | display: none !important; | ||
51 | } | ||
52 | |||
49 | 53 | ||
50 | footer { | 54 | footer { |
51 | border-top: 1px solid rgba(0, 0, 0, 0.2); | 55 | border-top: 1px solid rgba(0, 0, 0, 0.2); |