Component to embed Facebook videos and control them.
Official Facebook documentation for this class can be found here.
Usage<!-- basic usage -->
<fb-video href="https://www.facebook.com/facebook/videos/10153231379946729/"></fb-video>
<!-- event emitters -->
<fb-video href="https://www.facebook.com/facebook/videos/10153231379946729/" (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';
@Component(...)
export class MyComponent {
@ViewChild(FBVideoComponent) video: FBVideoComponent;
ngAfterViewInit() {
this.video.play();
this.video.pause();
this.video.getVolume();
}
}
Inputs
href
(string) The absolute URL of the video.
Allow the video to be played in fullscreen mode. Can be false or true. Defaults to false;
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.
The width of the video container. Min. 220px.
Set to true to include the text from the Facebook post associated with the video, if any.
Set to true to show captions (if available) by default. Captions are only available on desktop.
Fired when video starts to play.
Fired when video pauses.
Fired when video finishes playing.
Fired when video starts to buffer.
Fired when video recovers from buffering.
Fired when an error occurs on the video.
Plays the video.
Pauses the video.
Seeks to specified position.
Param | Type | Details | Default |
---|---|---|---|
seconds |
number
|
Mute the video.
Unmute the video.
Returns true if video is muted, false if not.
Set the volume
Param | Type | Details | Default |
---|---|---|---|
volume |
|
Get the volume
Returns the current video time position in seconds
Returns the video duration in seconds