import { Component , Input , Output , ElementRef , Renderer2 , OnInit , OnDestroy , EventEmitter } from '@angular/core' ; import { FBMLAttribute , FBMLComponent , FBMLInstanceMethod } from '../fbml-component' ; declare var FB ; name shortdesc fbdoc description usage Component ViewChild @ Component ( { selector : 'fb-video' , template : '' } ) export class FBVideoComponent extends FBMLComponent implements OnInit , OnDestroy { private _instance : any ; /**
     * The absolute URL of the video.
     */ @ Input ( ) @ FBMLAttribute href : string ; /**
     * Allow the video to be played in fullscreen mode. Can be false or true. Defaults to false;
     */ @ Input ( ) @ FBMLAttribute allowfullscreen : boolean ; /**
     * Automatically start playing the video when the page loads. The video will be played without sound (muted). People can turn on sound via the video player controls. This setting does not apply to mobile devices. Can be false or true. Defaults to false.
     */ @ Input ( ) @ FBMLAttribute autoplay : boolean ; /**
     * The width of the video container. Min. 220px.
     */ @ Input ( ) @ FBMLAttribute width : string ; /**
     * Set to true to include the text from the Facebook post associated with the video, if any.
     */ @ Input ( ) @ FBMLAttribute showText : boolean ; /**
     * Set to true to show captions (if available) by default. Captions are only available on desktop.
     */ @ Input ( ) @ FBMLAttribute showCaptions : boolean ; /**
     * Fired when video starts to play.
     */ @ Output ( ) startedPlaying : EventEmitter < any > = new EventEmitter < any > ( ) ; /**
     * Fired when video pauses.
     */ @ Output ( ) paused : EventEmitter < any > = new EventEmitter < any > ( ) ; /**
     *
     Fired when video finishes playing.
     */ @ Output ( ) finishedPlaying : EventEmitter < any > = new EventEmitter < any > ( ) ; /**
     * Fired when video starts to buffer.
     */ @ Output ( ) startedBuffering : EventEmitter < any > = new EventEmitter < any > ( ) ; /**
     * Fired when video recovers from buffering.
     */ @ Output ( ) finishedBuffering : EventEmitter < any > = new EventEmitter < any > ( ) ; /**
     * Fired when an error occurs on the video.
     */ @ Output ( ) error : EventEmitter < any > = new EventEmitter < any > ( ) ; private _id : string ; private _listeners : any [ ] = [ ] ; constructor ( el , rnd ) { super ( el , rnd , 'fb-video' ) ; this . nativeElement . id = this . _id = 'video-' + String ( Math . floor ( ( Math . random ( ) * 10000 ) + 1 ) ) ; } hidden ngOnInit ( ) { FB . Event . subscribe ( 'xfbml.ready' , ( msg ) => { if ( msg . type === 'video' && msg . id === this . _id ) { this . _instance = msg . instance ; this . _listeners . push ( this . _instance . subscribe ( 'startedPlaying' , ( e ) => this . startedPlaying . emit ( e ) ) , this . _instance . subscribe ( 'paused' , ( e ) => this . paused . emit ( e ) ) , this . _instance . subscribe ( 'finishedPlaying' , ( e ) => this . finishedPlaying . emit ( e ) ) , this . _instance . subscribe ( 'startedBuffering' , ( e ) => this . startedBuffering . emit ( e ) ) , this . _instance . subscribe ( 'finishedBuffering' , ( e ) => this . finishedBuffering . emit ( e ) ) , this . _instance . subscribe ( 'error' , ( e ) => this . error . emit ( e ) ) ) ; } } ) ; } hidden ngOnDestroy ( ) { this . _listeners . forEach ( l => { if ( typeof l . release === 'function' ) { l . release ( ) ; } } ) ; } /**
     * Plays the video.
     */ @ FBMLInstanceMethod play ( ) { } /**
     * Pauses the video.
     */ @ FBMLInstanceMethod pause ( ) { } param seconds { number } @ FBMLInstanceMethod seek ( seconds ) { } /**
     * Mute the video.
     */ @ FBMLInstanceMethod mute ( ) { } /**
     * Unmute the video.
     */ @ FBMLInstanceMethod unmute ( ) { } /**
     * Returns true if video is muted, false if not.
     */ @ FBMLInstanceMethod isMuted ( ) { return ; } param volume @ FBMLInstanceMethod setVolume ( volume ) { } /**
     * Get the volume
     */ @ FBMLInstanceMethod getVolume ( ) { return ; } /**
     * Returns the current video time position in seconds
     */ @ FBMLInstanceMethod getCurrentPosition ( ) { } /**
     * Returns the video duration in seconds
     */ @ FBMLInstanceMethod getDuration ( ) { } }