diff options
Diffstat (limited to 'client/src/app/videos/video-watch/webtorrent.service.ts')
-rw-r--r-- | client/src/app/videos/video-watch/webtorrent.service.ts | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/client/src/app/videos/video-watch/webtorrent.service.ts b/client/src/app/videos/video-watch/webtorrent.service.ts index bf38b5aaa..1839c7c27 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 @@ | |||
1 | // Don't use webtorrent typings for now | ||
2 | // It misses some little things I'll fix later | ||
3 | // <reference path="../../../../typings/globals/webtorrent/index.d.ts" /> | ||
4 | |||
5 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
2 | import { Subject } from 'rxjs/Subject'; | ||
6 | 3 | ||
7 | // import WebTorrent = require('webtorrent'); | 4 | declare const WebTorrent; |
8 | declare var WebTorrent: any; | ||
9 | 5 | ||
10 | @Injectable() | 6 | @Injectable() |
11 | export class WebTorrentService { | 7 | export class WebTorrentService { |
8 | errors = new Subject<Error>(); | ||
9 | warnings = new Subject<Error>(); | ||
10 | |||
11 | // TODO: use WebTorrent @type | ||
12 | // private client: WebTorrent.Client; | 12 | // private client: WebTorrent.Client; |
13 | private client: any; | 13 | private client: any; |
14 | 14 | ||
15 | constructor() { | 15 | constructor() { |
16 | this.client = new WebTorrent({ dht: false }); | 16 | this.client = new WebTorrent({ dht: false }); |
17 | |||
18 | this.client.on('error', (err) => this.errors.next(err)) | ||
19 | this.client.on('warning', (err) => this.warnings.next(err)) | ||
17 | } | 20 | } |
18 | 21 | ||
19 | add(magnetUri: string, callback: Function) { | 22 | add(magnetUri: string, callback: Function) { |