diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-08-12 17:35:00 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-08-12 17:35:10 +0200 |
commit | c323efb9cdc6a605242d112ac0c9db9f67eabaad (patch) | |
tree | 2879f9d94237b247edd85f1e78d5a8f0bb0b2f0f /client/src/app/videos/video-watch/video-watch.component.ts | |
parent | 602eb142bebb62f1774d6e17c211eef99ace584b (diff) | |
download | PeerTube-c323efb9cdc6a605242d112ac0c9db9f67eabaad.tar.gz PeerTube-c323efb9cdc6a605242d112ac0c9db9f67eabaad.tar.zst PeerTube-c323efb9cdc6a605242d112ac0c9db9f67eabaad.zip |
Update webtorrent -> 0.96
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.ts | 21 |
1 files changed, 14 insertions, 7 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 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 @@ | |||
1 | import { Component, ElementRef, OnDestroy, OnInit } from '@angular/core'; | 1 | import { Component, ElementRef, NgZone, OnDestroy, OnInit } from '@angular/core'; |
2 | import { ActivatedRoute } from '@angular/router'; | 2 | import { ActivatedRoute } from '@angular/router'; |
3 | 3 | ||
4 | import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'; | 4 | import { 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 | } |