]>
Commit | Line | Data |
---|---|---|
df98563e | 1 | import { Component, Input, ViewChild } from '@angular/core' |
cf02fbfb | 2 | |
df98563e | 3 | import { ModalDirective } from 'ngx-bootstrap/modal' |
cf02fbfb | 4 | |
df98563e | 5 | import { Video } from '../shared' |
cf02fbfb C |
6 | |
7 | @Component({ | |
8 | selector: 'my-video-share', | |
9 | templateUrl: './video-share.component.html' | |
10 | }) | |
11 | export class VideoShareComponent { | |
df98563e | 12 | @Input() video: Video = null |
cf02fbfb | 13 | |
df98563e | 14 | @ViewChild('modal') modal: ModalDirective |
cf02fbfb | 15 | |
df98563e | 16 | constructor () { |
cf02fbfb C |
17 | // empty |
18 | } | |
19 | ||
df98563e C |
20 | show () { |
21 | this.modal.show() | |
cf02fbfb C |
22 | } |
23 | ||
df98563e C |
24 | hide () { |
25 | this.modal.hide() | |
cf02fbfb C |
26 | } |
27 | ||
df98563e | 28 | getVideoIframeCode () { |
cf02fbfb C |
29 | return '<iframe width="560" height="315" ' + |
30 | 'src="' + window.location.origin + '/videos/embed/' + this.video.id + '" ' + | |
31 | 'frameborder="0" allowfullscreen>' + | |
df98563e | 32 | '</iframe>' |
cf02fbfb C |
33 | } |
34 | ||
df98563e C |
35 | getVideoUrl () { |
36 | return window.location.href | |
cf02fbfb | 37 | } |
2c8d4697 | 38 | |
df98563e C |
39 | notSecure () { |
40 | return window.location.protocol === 'http:' | |
2c8d4697 | 41 | } |
cf02fbfb | 42 | } |