Eduardo
Eduardo

Reputation: 1831

How to embed facebook video on my website

I have created a script to upload videos to my own page on Facebook, that part works perfectly. But now I want to show the videos on my site, at least a thumbnail. So I searched for how to embed videos on external pages, tried the example but it is not working:

<div  
    class="fb-video" 
    data-href="https://www.facebook.com/facebook/videos/10153231379946729/" 
    data-width="500" 
    data-allowfullscreen="true"></div>

I also noticed Facebook videos do not have the option to generate embedded code when sharing, so maybe it is not allowed anymore? maybe I can show a thumbnail?.

Thanks in advance for your help.

Upvotes: 2

Views: 3854

Answers (2)

Eduardo
Eduardo

Reputation: 1831

The example and the answer above is correct. My problem was a different one. In order to publish a video in Facebook through API, you need "publish_video" permission, while the app is in "development" mode, it works, but reviewing the video on the player does not work.

If I move the app to "live" mode, I can see the video on the player but I can not upload more videos.

So I need to send my app to review. I hope this helps someone in the future.

Upvotes: 0

Anar Rzayev
Anar Rzayev

Reputation: 360

Firstly, make sure the video you want to embed is public for everybody. Secondly, You must add Facebook SDK to your Html page before embedding the video

  <div id="fb-root"></div>
  <script async defer src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2"></script>

  <!-- Your embedded video player code -->
  <div class="fb-video" data-href="https://www.facebook.com/facebook/videos/10153231379946729/" data-width="500" data-show-text="false">
    <div class="fb-xfbml-parse-ignore">
      <blockquote cite="https://www.facebook.com/facebook/videos/10153231379946729/">
        <a href="https://www.facebook.com/facebook/videos/10153231379946729/">How to Share With Just Friends</a>
        <p>How to share with just friends.</p>
        Posted by <a href="https://www.facebook.com/facebook/">Facebook</a> on Friday, December 5, 2014
      </blockquote>
    </div>
  </div>

Try the code below. https://jsbin.com/rawutihuto/edit?html,output

Upvotes: 4

Related Questions