1 import { Component, ElementRef, Input, ViewChild } from '@angular/core'
2 import { NotificationsService } from 'angular2-notifications'
3 import { VideoDetails } from '../../../shared/video/video-details.model'
4 import { buildVideoEmbed } from '../../../../assets/player/utils'
5 import { I18n } from '@ngx-translate/i18n-polyfill'
6 import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
9 selector: 'my-video-share',
10 templateUrl: './video-share.component.html',
11 styleUrls: [ './video-share.component.scss' ]
13 export class VideoShareComponent {
14 @Input() video: VideoDetails = null
16 @ViewChild('modal') modal: ElementRef
19 private modalService: NgbModal,
20 private notificationsService: NotificationsService,
27 this.modalService.open(this.modal)
30 getVideoIframeCode () {
31 return buildVideoEmbed(this.video.embedUrl)
35 return window.location.href
39 return window.location.protocol === 'http:'
42 activateCopiedMessage () {
43 this.notificationsService.success(this.i18n('Success'), this.i18n('Copied'))