]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Update webtorrent -> 0.96
authorChocobozzz <florian.bigard@gmail.com>
Fri, 12 Aug 2016 15:35:00 +0000 (17:35 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 12 Aug 2016 15:35:10 +0000 (17:35 +0200)
client/package.json
client/src/app/shared/search/search.component.ts
client/src/app/videos/video-watch/video-watch.component.ts
package.json

index b01e768b30432fd13fcf297ae3bfc00c3a0f43cb..46cbb9441975565960a075657853f2c0da4df4db 100644 (file)
@@ -63,7 +63,7 @@
     "webpack-md5-hash": "0.0.5",
     "webpack-merge": "^0.13.0",
     "webpack-notifier": "^1.3.0",
-    "webtorrent": "^0.93.2",
+    "webtorrent": "^0.96.0",
     "zone.js": "0.6.12"
   },
   "devDependencies": {
index e864fbc172350776b38ae8784cae22e4959721e3..219997e85b5a29388a3c2510c13e7abaf8d4883b 100644 (file)
@@ -28,7 +28,7 @@ export class SearchComponent implements OnInit {
   constructor(private searchService: SearchService) {}
 
   ngOnInit() {
-    // Subscribe is the search changed
+    // Subscribe if the search changed
     // Usually changed by videos list component
     this.searchService.updateSearch.subscribe(
       newSearchCriterias => {
index 09255de5d3d2076db05b1acae3946198841053a6..bc0e3157dcf7a4f56dd8b17f7552979429dd90e6 100644 (file)
@@ -1,4 +1,4 @@
-import { Component, ElementRef, OnDestroy, OnInit } from '@angular/core';
+import { Component, ElementRef, NgZone, OnDestroy, OnInit } from '@angular/core';
 import { ActivatedRoute } from '@angular/router';
 
 import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
@@ -31,6 +31,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 
   constructor(
     private elementRef: ElementRef,
+    private ngZone: NgZone,
     private route: ActivatedRoute,
     private videoService: VideoService,
     private webTorrentService: WebTorrentService
@@ -65,12 +66,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
         }
       });
 
-      // Refresh each second
-      this.torrentInfosInterval = setInterval(() => {
-        this.downloadSpeed = torrent.downloadSpeed;
-        this.numPeers = torrent.numPeers;
-        this.uploadSpeed = torrent.uploadSpeed;
-      }, 1000);
+      this.runInProgress(torrent);
     });
   }
 
@@ -99,4 +95,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     this.error = true;
     console.error('The video load seems to be abnormally long.');
   }
+
+  private runInProgress(torrent: any) {
+    // Refresh each second
+    this.torrentInfosInterval = setInterval(() => {
+      this.ngZone.run(() => {
+        this.downloadSpeed = torrent.downloadSpeed;
+        this.numPeers = torrent.numPeers;
+        this.uploadSpeed = torrent.uploadSpeed;
+      });
+    }, 1000);
+  }
 }
index 310810377672d3641698e287c2821b8bba2e8cac..c83ede5c27baed011de8071b3214468ff88f0678 100644 (file)
@@ -60,7 +60,7 @@
     "scripty": "^1.5.0",
     "segfault-handler": "^1.0.0",
     "ursa": "^0.9.1",
-    "webtorrent": "^0.93.2",
+    "webtorrent": "^0.96.0",
     "winston": "^2.1.1",
     "ws": "^1.1.1"
   },