From 4a7591e1a8ec5ffdff85580c6be4b18d8b85b4d4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 8 Jun 2018 15:35:18 +0200 Subject: Remove video not found --- client/src/app/+page-not-found/page-not-found-routing.module.ts | 9 ++++++++- client/src/app/+page-not-found/page-not-found.component.scss | 2 +- client/src/app/videos/+video-watch/video-watch.component.html | 4 +--- client/src/app/videos/+video-watch/video-watch.component.ts | 6 ------ client/src/assets/player/peertube-videojs-plugin.ts | 7 ++----- 5 files changed, 12 insertions(+), 16 deletions(-) (limited to 'client') diff --git a/client/src/app/+page-not-found/page-not-found-routing.module.ts b/client/src/app/+page-not-found/page-not-found-routing.module.ts index 306d2d54d..e3407099d 100644 --- a/client/src/app/+page-not-found/page-not-found-routing.module.ts +++ b/client/src/app/+page-not-found/page-not-found-routing.module.ts @@ -1,11 +1,18 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' import { PageNotFoundComponent } from './page-not-found.component' +import { MetaGuard } from '@ngx-meta/core' const pageNotFoundRoutes: Routes = [ { path: '', - component: PageNotFoundComponent + component: PageNotFoundComponent, + canActivate: [ MetaGuard ], + data: { + meta: { + title: 'Not found' + } + } } ] diff --git a/client/src/app/+page-not-found/page-not-found.component.scss b/client/src/app/+page-not-found/page-not-found.component.scss index 05d45f97f..53b6142e1 100644 --- a/client/src/app/+page-not-found/page-not-found.component.scss +++ b/client/src/app/+page-not-found/page-not-found.component.scss @@ -2,7 +2,7 @@ div { height: 100%; width: 100%; text-align: center; - margin-top: 50px; + margin-top: 150px; font-size: 32px; } \ No newline at end of file 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 d80b633df..4c650b121 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html @@ -1,10 +1,8 @@
-
+
-
Video not found :'(
-
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 4a67d456e..7ba8d1fa4 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -46,7 +46,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy { playerElement: HTMLVideoElement userRating: UserVideoRateType = null video: VideoDetails = null - videoNotFound = false descriptionLoading = false completeDescriptionShown = false @@ -119,11 +118,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy { const startTime = this.route.snapshot.queryParams.start this.onVideoFetched(video, startTime) .catch(err => this.handleError(err)) - }, - - error => { - this.videoNotFound = true - console.error(error) } ) }) diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 057bc4b2a..47288c842 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts @@ -195,22 +195,19 @@ class PeerTubePlugin extends Plugin { this.torrent = webtorrent.add(magnetOrTorrentUrl, torrentOptions, torrent => { console.log('Added ' + magnetOrTorrentUrl + '.') - // Pause the old torrent if (oldTorrent) { + // Pause the old torrent oldTorrent.pause() // Pause does not remove actual peers (in particular the webseed peer) oldTorrent.removePeer(oldTorrent['ws']) // We use a fake renderer so we download correct pieces of the next file - // This way we'll be able to if (options.delay) { const fakeVideoElem = document.createElement('video') renderVideo(torrent.files[0], fakeVideoElem, { autoplay: false, controls: false }, (err, renderer) => { fakeRenderer = renderer - if (err) { - console.error('Cannot render new torrent in fake video element.', err) - } + if (err) console.error('Cannot render new torrent in fake video element.', err) // Load the future file at the correct time fakeVideoElem.currentTime = this.player.currentTime() + (options.delay / 2000) -- cgit v1.2.3