aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-watch/video-share.component.ts
blob: 0b85052cd81a65872c5df927ade7035c8fab61d4 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { Component, Input, ViewChild } from '@angular/core';

import { ModalDirective } from 'ng2-bootstrap/modal';

import { Video } from '../shared';

@Component({
  selector: 'my-video-share',
  templateUrl: './video-share.component.html'
})
export class VideoShareComponent {
  @Input() video: Video = null;

  @ViewChild('modal') modal: ModalDirective;

  constructor() {
    // empty
  }

  show() {
    this.modal.show();
  }

  hide() {
    this.modal.hide();
  }

  getVideoIframeCode() {
    return '<iframe width="560" height="315" ' +
           'src="' + window.location.origin + '/videos/embed/' + this.video.id + '" ' +
           'frameborder="0" allowfullscreen>' +
           '</iframe>';
  }

  getVideoUrl() {
    return window.location.href;
  }

  notSecure() {
    return window.location.protocol === 'http:';
  }
}