Back to home

Embedded Video (class exported as FBVideoComponent)

Component to embed Facebook videos and control them.

Official Facebook documentation for this class can be found here.

link Usage
<!-- basic usage -->
<fb-video href=""></fb-video>

<!-- event emitters -->
<fb-video href="" (paused)="onVideoPaused($event)"></fb-video>

To manually interact with the video player, fetch it using ViewChild.

import { Component, ViewChild } from '@angular/core';
import { FBVideoComponent } from 'ngx-facebook-sdk';

export class MyComponent {

  @ViewChild(FBVideoComponent) video: FBVideoComponent;

  ngAfterViewInit() {;;;

link Inputs link href (string)

The absolute URL of the video.

link allowfullscreen (boolean)

Allow the video to be played in fullscreen mode. Can be false or true. Defaults to false;

link autoplay (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.

link width (string)

The width of the video container. Min. 220px.

link showText (boolean)

Set to true to include the text from the Facebook post associated with the video, if any.

link showCaptions (boolean)

Set to true to show captions (if available) by default. Captions are only available on desktop.

link Outputs link startedPlaying

Fired when video starts to play.

link paused

Fired when video pauses.

link finishedPlaying

Fired when video finishes playing.

link startedBuffering

Fired when video starts to buffer.

link finishedBuffering

Fired when video recovers from buffering.

link error

Fired when an error occurs on the video.

link Instance Methods link ngOnInit
link ngOnDestroy
link play

Plays the video.

link pause

Pauses the video.

link seek

Seeks to specified position.

Param Type Details Default
seconds number

link mute

Mute the video.

link unmute

Unmute the video.

link isMuted

Returns true if video is muted, false if not.

link setVolume

Set the volume

Param Type Details Default

link getVolume

Get the volume

link getCurrentPosition

Returns the current video time position in seconds

link getDuration

Returns the video duration in seconds