aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/package.json2
-rw-r--r--client/src/app/shared/search/search.component.ts2
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts21
-rw-r--r--package.json2
4 files changed, 17 insertions, 10 deletions
diff --git a/client/package.json b/client/package.json
index b01e768b3..46cbb9441 100644
--- a/client/package.json
+++ b/client/package.json
@@ -63,7 +63,7 @@
63 "webpack-md5-hash": "0.0.5", 63 "webpack-md5-hash": "0.0.5",
64 "webpack-merge": "^0.13.0", 64 "webpack-merge": "^0.13.0",
65 "webpack-notifier": "^1.3.0", 65 "webpack-notifier": "^1.3.0",
66 "webtorrent": "^0.93.2", 66 "webtorrent": "^0.96.0",
67 "zone.js": "0.6.12" 67 "zone.js": "0.6.12"
68 }, 68 },
69 "devDependencies": { 69 "devDependencies": {
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts
index e864fbc17..219997e85 100644
--- a/client/src/app/shared/search/search.component.ts
+++ b/client/src/app/shared/search/search.component.ts
@@ -28,7 +28,7 @@ export class SearchComponent implements OnInit {
28 constructor(private searchService: SearchService) {} 28 constructor(private searchService: SearchService) {}
29 29
30 ngOnInit() { 30 ngOnInit() {
31 // Subscribe is the search changed 31 // Subscribe if the search changed
32 // Usually changed by videos list component 32 // Usually changed by videos list component
33 this.searchService.updateSearch.subscribe( 33 this.searchService.updateSearch.subscribe(
34 newSearchCriterias => { 34 newSearchCriterias => {
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 09255de5d..bc0e3157d 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -1,4 +1,4 @@
1import { Component, ElementRef, OnDestroy, OnInit } from '@angular/core'; 1import { Component, ElementRef, NgZone, OnDestroy, OnInit } from '@angular/core';
2import { ActivatedRoute } from '@angular/router'; 2import { ActivatedRoute } from '@angular/router';
3 3
4import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'; 4import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
@@ -31,6 +31,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
31 31
32 constructor( 32 constructor(
33 private elementRef: ElementRef, 33 private elementRef: ElementRef,
34 private ngZone: NgZone,
34 private route: ActivatedRoute, 35 private route: ActivatedRoute,
35 private videoService: VideoService, 36 private videoService: VideoService,
36 private webTorrentService: WebTorrentService 37 private webTorrentService: WebTorrentService
@@ -65,12 +66,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
65 } 66 }
66 }); 67 });
67 68
68 // Refresh each second 69 this.runInProgress(torrent);
69 this.torrentInfosInterval = setInterval(() => {
70 this.downloadSpeed = torrent.downloadSpeed;
71 this.numPeers = torrent.numPeers;
72 this.uploadSpeed = torrent.uploadSpeed;
73 }, 1000);
74 }); 70 });
75 } 71 }
76 72
@@ -99,4 +95,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
99 this.error = true; 95 this.error = true;
100 console.error('The video load seems to be abnormally long.'); 96 console.error('The video load seems to be abnormally long.');
101 } 97 }
98
99 private runInProgress(torrent: any) {
100 // Refresh each second
101 this.torrentInfosInterval = setInterval(() => {
102 this.ngZone.run(() => {
103 this.downloadSpeed = torrent.downloadSpeed;
104 this.numPeers = torrent.numPeers;
105 this.uploadSpeed = torrent.uploadSpeed;
106 });
107 }, 1000);
108 }
102} 109}
diff --git a/package.json b/package.json
index 310810377..c83ede5c2 100644
--- a/package.json
+++ b/package.json
@@ -60,7 +60,7 @@
60 "scripty": "^1.5.0", 60 "scripty": "^1.5.0",
61 "segfault-handler": "^1.0.0", 61 "segfault-handler": "^1.0.0",
62 "ursa": "^0.9.1", 62 "ursa": "^0.9.1",
63 "webtorrent": "^0.93.2", 63 "webtorrent": "^0.96.0",
64 "winston": "^2.1.1", 64 "winston": "^2.1.1",
65 "ws": "^1.1.1" 65 "ws": "^1.1.1"
66 }, 66 },