aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-04 16:04:50 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-04 16:04:50 +0100
commitd1992b93f0f4a4408f803d6320cd26a713e22d5b (patch)
treee01a8d5b6c37ebdf0f2a190a374d7b97c0508d8b /client/src/app/videos/video-watch/video-watch.component.ts
parent4d19d2f10b691650abe030d0dbb52dc7c8a62441 (diff)
downloadPeerTube-d1992b93f0f4a4408f803d6320cd26a713e22d5b.tar.gz
PeerTube-d1992b93f0f4a4408f803d6320cd26a713e22d5b.tar.zst
PeerTube-d1992b93f0f4a4408f803d6320cd26a713e22d5b.zip
Client: add more informations to watch video view
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.ts46
1 files changed, 23 insertions, 23 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 239e24c99..9a36c17e2 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -18,7 +18,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
18 loading: boolean = false; 18 loading: boolean = false;
19 numPeers: number; 19 numPeers: number;
20 uploadSpeed: number; 20 uploadSpeed: number;
21 video: Video; 21 video: Video = null;
22 22
23 private errorTimer: NodeJS.Timer; 23 private errorTimer: NodeJS.Timer;
24 private sub: any; 24 private sub: any;
@@ -32,6 +32,28 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
32 private webTorrentService: WebTorrentService 32 private webTorrentService: WebTorrentService
33 ) {} 33 ) {}
34 34
35 ngOnInit() {
36 this.sub = this.route.params.subscribe(routeParams => {
37 let id = routeParams['id'];
38 this.videoService.getVideo(id).subscribe(
39 video => {
40 this.video = video;
41 this.loadVideo();
42 },
43 error => alert(error.text)
44 );
45 });
46 }
47
48 ngOnDestroy() {
49 console.log('Removing video from webtorrent.');
50 clearInterval(this.torrentInfosInterval);
51 clearTimeout(this.errorTimer);
52 this.webTorrentService.remove(this.video.magnetUri);
53
54 this.sub.unsubscribe();
55 }
56
35 loadVideo() { 57 loadVideo() {
36 // Reset the error 58 // Reset the error
37 this.error = false; 59 this.error = false;
@@ -65,28 +87,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
65 }); 87 });
66 } 88 }
67 89
68 ngOnDestroy() {
69 console.log('Removing video from webtorrent.');
70 clearInterval(this.torrentInfosInterval);
71 clearTimeout(this.errorTimer);
72 this.webTorrentService.remove(this.video.magnetUri);
73
74 this.sub.unsubscribe();
75 }
76
77 ngOnInit() {
78 this.sub = this.route.params.subscribe(routeParams => {
79 let id = routeParams['id'];
80 this.videoService.getVideo(id).subscribe(
81 video => {
82 this.video = video;
83 this.loadVideo();
84 },
85 error => alert(error.text)
86 );
87 });
88 }
89
90 private loadTooLong() { 90 private loadTooLong() {
91 this.error = true; 91 this.error = true;
92 console.error('The video load seems to be abnormally long.'); 92 console.error('The video load seems to be abnormally long.');