aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-watch/webtorrent.service.ts
blob: bf38b5aaaa38da97edd5d136212422c7cc2c36e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Don't use webtorrent typings for now
// It misses some little things I'll fix later
// <reference path="../../../../typings/globals/webtorrent/index.d.ts" />

import { Injectable } from '@angular/core';

// import WebTorrent = require('webtorrent');
declare var WebTorrent: any;

@Injectable()
export class WebTorrentService {
  // private client: WebTorrent.Client;
  private client: any;

  constructor() {
    this.client = new WebTorrent({ dht: false });
  }

  add(magnetUri: string, callback: Function) {
    return this.client.add(magnetUri, callback);
  }

  remove(magnetUri: string) {
    return this.client.remove(magnetUri);
  }
}