"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": {
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 => {
-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';
constructor(
private elementRef: ElementRef,
+ private ngZone: NgZone,
private route: ActivatedRoute,
private videoService: VideoService,
private webTorrentService: WebTorrentService
}
});
- // Refresh each second
- this.torrentInfosInterval = setInterval(() => {
- this.downloadSpeed = torrent.downloadSpeed;
- this.numPeers = torrent.numPeers;
- this.uploadSpeed = torrent.uploadSpeed;
- }, 1000);
+ this.runInProgress(torrent);
});
}
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);
+ }
}
"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"
},