aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/videos/components/watch
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-14 22:16:43 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-14 22:16:43 +0100
commit98b01bac2c2c4536aa97d826b61516657f4d15f5 (patch)
tree75fe2d75f1c58c6897127f03cfb7d8b654545227 /client/angular/videos/components/watch
parentdc8bc31be517a53e8fbe7100cfe45cd73f596de0 (diff)
downloadPeerTube-98b01bac2c2c4536aa97d826b61516657f4d15f5.tar.gz
PeerTube-98b01bac2c2c4536aa97d826b61516657f4d15f5.tar.zst
PeerTube-98b01bac2c2c4536aa97d826b61516657f4d15f5.zip
Angular 2 : draft 2
Diffstat (limited to 'client/angular/videos/components/watch')
-rw-r--r--client/angular/videos/components/watch/videos-watch.component.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/client/angular/videos/components/watch/videos-watch.component.ts b/client/angular/videos/components/watch/videos-watch.component.ts
index e3a973820..da7f942db 100644
--- a/client/angular/videos/components/watch/videos-watch.component.ts
+++ b/client/angular/videos/components/watch/videos-watch.component.ts
@@ -1,8 +1,9 @@
1/// <reference path='../../../../typings/browser/ambient/webtorrent/webtorrent.d.ts' /> 1/// <reference path='../../../../typings/browser/ambient/webtorrent/webtorrent.d.ts' />
2 2
3import { Component, OnInit, ElementRef } from 'angular2/core'; 3import { Component, OnInit, ElementRef } from 'angular2/core';
4import { RouteParams } from 'angular2/router'; 4import { RouteParams, CanDeactivate, ComponentInstruction } from 'angular2/router';
5 5
6// TODO import it with systemjs
6declare var WebTorrent: any; 7declare var WebTorrent: any;
7 8
8import { Video } from '../../models/video'; 9import { Video } from '../../models/video';
@@ -14,7 +15,7 @@ import { VideosService } from '../../services/videos.service';
14 styleUrls: [ 'app/angular/videos/components/watch/videos-watch.component.css' ] 15 styleUrls: [ 'app/angular/videos/components/watch/videos-watch.component.css' ]
15}) 16})
16 17
17export class VideosWatchComponent { 18export class VideosWatchComponent implements OnInit, CanDeactivate {
18 video: Video; 19 video: Video;
19 20
20 private client: any; 21 private client: any;
@@ -24,6 +25,7 @@ export class VideosWatchComponent {
24 private _routeParams: RouteParams, 25 private _routeParams: RouteParams,
25 private _elementRef: ElementRef 26 private _elementRef: ElementRef
26 ) { 27 ) {
28 // TODO: use a service
27 this.client = new WebTorrent({ dht: false }); 29 this.client = new WebTorrent({ dht: false });
28 } 30 }
29 31
@@ -47,4 +49,10 @@ export class VideosWatchComponent {
47 }) 49 })
48 }) 50 })
49 } 51 }
52
53 routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction) : any {
54 console.log('Removing video from webtorrent.');
55 this.client.remove(this.video.magnetUri);
56 return true;
57 }
50} 58}