aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-watch
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/video-watch')
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts21
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 @@
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}