aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-29 18:35:19 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-29 18:35:19 +0100
commit13fc89f4a4b91b3da10493517de556240fb65463 (patch)
tree7db4316f1d742b1ece07983c33b03e7f5d6d3fde /client/src/app/videos/video-watch/video-watch.component.ts
parent5769e1db8d3d5a1e3baa8dff23090cfe93d48a50 (diff)
downloadPeerTube-13fc89f4a4b91b3da10493517de556240fb65463.tar.gz
PeerTube-13fc89f4a4b91b3da10493517de556240fb65463.tar.zst
PeerTube-13fc89f4a4b91b3da10493517de556240fb65463.zip
Client: notify client if there are webtorrent errors
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.ts16
1 files changed, 12 insertions, 4 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 c27133f74..9ac9342b7 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -1,5 +1,6 @@
1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; 1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
2import { ActivatedRoute } from '@angular/router'; 2import { ActivatedRoute } from '@angular/router';
3import { Subscription } from 'rxjs/Subscription';
3 4
4import * as videojs from 'video.js'; 5import * as videojs from 'video.js';
5import { MetaService } from 'ng2-meta'; 6import { MetaService } from 'ng2-meta';
@@ -36,7 +37,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
36 videoNotFound = false; 37 videoNotFound = false;
37 38
38 private errorTimer: number; 39 private errorTimer: number;
39 private sub: any; 40 private paramsSub: Subscription;
41 private errorsSub: Subscription;
42 private warningsSub: Subscription;
40 private torrentInfosInterval: number; 43 private torrentInfosInterval: number;
41 44
42 constructor( 45 constructor(
@@ -51,7 +54,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
51 ) {} 54 ) {}
52 55
53 ngOnInit() { 56 ngOnInit() {
54 this.sub = this.route.params.subscribe(routeParams => { 57 this.paramsSub = this.route.params.subscribe(routeParams => {
55 let id = routeParams['id']; 58 let id = routeParams['id'];
56 this.videoService.getVideo(id).subscribe( 59 this.videoService.getVideo(id).subscribe(
57 video => { 60 video => {
@@ -76,6 +79,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
76 videojs(this.playerElement, videojsOptions, function () { 79 videojs(this.playerElement, videojsOptions, function () {
77 self.player = this; 80 self.player = this;
78 }); 81 });
82
83 this.errorsSub = this.webTorrentService.errors.subscribe(err => this.notificationsService.error('Error', err.message));
84 this.warningsSub = this.webTorrentService.errors.subscribe(err => this.notificationsService.alert('Warning', err.message));
79 } 85 }
80 86
81 ngOnDestroy() { 87 ngOnDestroy() {
@@ -91,8 +97,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
91 // Remove player 97 // Remove player
92 videojs(this.playerElement).dispose(); 98 videojs(this.playerElement).dispose();
93 99
94 // Unsubscribe route subscription 100 // Unsubscribe subscriptions
95 this.sub.unsubscribe(); 101 this.paramsSub.unsubscribe();
102 this.errorsSub.unsubscribe();
103 this.warningsSub.unsubscribe();
96 } 104 }
97 105
98 loadVideo() { 106 loadVideo() {