Client: add video not found message if the video... is not found

This commit is contained in:
Chocobozzz 2016-11-16 20:09:36 +01:00
parent 73ce7f9676
commit 9c89a45cb2
5 changed files with 28 additions and 3 deletions

View File

@ -17,3 +17,7 @@ header div {
padding: 0 3px 0 3px; padding: 0 3px 0 3px;
} }
} }
[hidden] {
display: none !important;
}

View File

@ -15,9 +15,12 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="embed-responsive embed-responsive-19by9"> <!-- We need the video container for videojs so we just hide it -->
<div [hidden]="videoNotFound" class="embed-responsive embed-responsive-19by9">
<video id="video-container" class="video-js vjs-default-skin vjs-big-play-centered"></video> <video id="video-container" class="video-js vjs-default-skin vjs-big-play-centered"></video>
</div> </div>
<div *ngIf="videoNotFound" id="video-not-found">Video not found :'(</div>
</div> </div>
</div> </div>

View File

@ -3,6 +3,14 @@
height: 100%; height: 100%;
} }
#video-not-found {
height: 300px;
line-height: 300px;
margin-top: 50px;
text-align: center;
font-weight: bold;
}
.embed-responsive { .embed-responsive {
height: 500px; height: 500px;
} }

View File

@ -28,6 +28,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
playerElement: Element; playerElement: Element;
uploadSpeed: number; uploadSpeed: number;
video: Video = null; video: Video = null;
videoNotFound = false;
private errorTimer: NodeJS.Timer; private errorTimer: NodeJS.Timer;
private sub: any; private sub: any;
@ -51,7 +52,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.setOpenGraphTags(); this.setOpenGraphTags();
this.loadVideo(); 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.'); console.log('Removing video from webtorrent.');
clearInterval(this.torrentInfosInterval); clearInterval(this.torrentInfosInterval);
clearTimeout(this.errorTimer); clearTimeout(this.errorTimer);
this.webTorrentService.remove(this.video.magnetUri);
if (this.video !== null) {
this.webTorrentService.remove(this.video.magnetUri);
}
// Remove player // Remove player
videojs(this.playerElement).dispose(); videojs(this.playerElement).dispose();

View File

@ -46,6 +46,10 @@ menu {
width: 200px; width: 200px;
} }
[hidden] {
display: none !important;
}
footer { footer {
border-top: 1px solid rgba(0, 0, 0, 0.2); border-top: 1px solid rgba(0, 0, 0, 0.2);