diff options
Diffstat (limited to 'client/app/videos/video-watch/webtorrent.service.ts')
-rw-r--r-- | client/app/videos/video-watch/webtorrent.service.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/client/app/videos/video-watch/webtorrent.service.ts b/client/app/videos/video-watch/webtorrent.service.ts new file mode 100644 index 000000000..0c73ab4f4 --- /dev/null +++ b/client/app/videos/video-watch/webtorrent.service.ts | |||
@@ -0,0 +1,26 @@ | |||
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'; | ||
6 | |||
7 | // import WebTorrent = require('webtorrent'); | ||
8 | declare var WebTorrent: any; | ||
9 | |||
10 | @Injectable() | ||
11 | export class WebTorrentService { | ||
12 | // private client: WebTorrent.Client; | ||
13 | private client: any; | ||
14 | |||
15 | constructor() { | ||
16 | this.client = new WebTorrent({ dht: false }); | ||
17 | } | ||
18 | |||
19 | add(magnetUri: string, callback: Function) { | ||
20 | return this.client.add(magnetUri, callback); | ||
21 | } | ||
22 | |||
23 | remove(magnetUri: string) { | ||
24 | return this.client.remove(magnetUri); | ||
25 | } | ||
26 | } | ||