X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2Fvideo-watch%2Fwebtorrent.service.ts;h=0192167ee88405922fa06f4baace204139253105;hb=d38b82810638b9f664c9016fac2684454c273a77;hp=bf38b5aaaa38da97edd5d136212422c7cc2c36e5;hpb=4a6995be18b15de1834a39c8921a0e4109671bb6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/videos/video-watch/webtorrent.service.ts b/client/src/app/videos/video-watch/webtorrent.service.ts index bf38b5aaa..0192167ee 100644 --- a/client/src/app/videos/video-watch/webtorrent.service.ts +++ b/client/src/app/videos/video-watch/webtorrent.service.ts @@ -1,19 +1,22 @@ -// Don't use webtorrent typings for now -// It misses some little things I'll fix later -// - import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs/Subject'; -// import WebTorrent = require('webtorrent'); -declare var WebTorrent: any; +declare const WebTorrent; @Injectable() export class WebTorrentService { + errors = new Subject(); + warnings = new Subject(); + + // TODO: use WebTorrent @type // private client: WebTorrent.Client; private client: any; constructor() { this.client = new WebTorrent({ dht: false }); + + this.client.on('error', (err) => this.errors.next(err)); + this.client.on('warning', (err) => this.warnings.next(err)); } add(magnetUri: string, callback: Function) {