react-fb-player
This is a modified fork of react-youtube with new features
Installation
$ npm install react-fb-player --save
Usage
const FacebookPlayer = ; <FacebookPlayer appId= string // (required) Your Facebook App ID. Ref: http://bit.ly/1GNA0AN videoId= string // (required) Video´s ID Ref: http://bit.ly/1ysgVu4 id= string // Element ID. Required if you wanna use more than one video in the same page. className= string // Element class. allowfullscreen= boolean autoplay= boolean width= number showText= boolean showCaptions= boolean onReady=
You can use onReady() to assign the player to a state and then control it (http://bit.ly/29Oxmgm).
;; PureComponent { superprops; thisstate = player: null ; } { this; } { const player = thisstate; if player player; }; { const player = thisstate; if player player; }; { return <div className="FBVideoPlayer"> thispropsappId ? <div> <FacebookPlayer appId=`` videoId=`` id=`` className=thispropsclassName allowfullscreen=thispropsallowfullscreen autoplay=thispropsautoplay width=thispropswidth ? thispropswidth : 600 showText=thispropsshowText showCaptions=thispropsshowCaptions onReady= thisonReady onStartedPlaying=thispropsonStartedPlaying onPaused=thispropsonPaused onFinishedPlaying=thispropsonFinishedPlaying onStartedBuffering=thispropsonStartedBuffering onFinishedBuffering=thispropsonStartedBuffering onError=thispropsonError /> <button onClick= thisplayVideo >Play</button> <button onClick= thispauseVideo >Pause</button> </div> : <div className="content"> <div className="err-msg"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/F_icon.svg/2000px-F_icon.svg.png" /> <span>Facebook Video Player</span> <h3>Sorry you need </h3> </div> <div className="code-snippet"> <pre> <span>'<FBVideoPlayer appId="yourAppId" videoId="yourVideoId" width={numberOfPixels}/>'</span> </pre> </div> </div> </div> ; }
License
ISC