aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-share.component.ts
blob: aeef65ecfbd5a87b8b6c8083926a569dc3c3aeae (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                                           
 
                                                    
 
                                        





                                             
                                     
 
                                           
 
                  


            

                     

   

                     

   
                         
                                                
                                                 
                                               
                      

   

                               
   
 

                                               
   
 
import { Component, Input, ViewChild } from '@angular/core'

import { ModalDirective } from 'ngx-bootstrap/modal'

import { VideoDetails } from '../shared'

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

  @ViewChild('modal') modal: ModalDirective

  constructor () {
    // empty
  }

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

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

  getVideoIframeCode () {
    return '<iframe width="560" height="315" ' +
           'src="' + this.video.embedUrl + '" ' +
           'frameborder="0" allowfullscreen>' +
           '</iframe>'
  }

  getVideoUrl () {
    return window.location.href
  }

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