Web Niraj
  • Facebook
  • Flickr
  • Github
  • Instagram
  • Linkedin
  • Twitter
  • YouTube
Online portfolio, code examples and developer blog
  • About
  • Contact
  • Portfolio
  • WordPress
  • Apps
    • Gemini Quota App for macOS
Search the site...
  • Home
  • Code Examples
  • YouTube and Facebook (Social Video) Example

YouTube and Facebook (Social Video) Example

0

Here is an example of socialising a YouTube video with Facebook’s social plugins. In this example, I’ve integrated a simple video with the Facebook Like and Comment plugins. For styling, I’ve used the Twitter Bootstrap CSS Framework.

Working Demo

<!DOCTYPE html>
<html>
<!--
Created using jsbin.com
Source can be edited via http://jsbin.com/elafon/1/edit
-->
<head>
<title>YouTube - Like Button - Comments</title>
<link href="socialYoutube.css" rel="stylesheet">
</head>
<body>
<!--
Code by: Niraj Shah - www.webniraj.com
-->
<div>
<div>
<div>
<a >Youtube Social App</a>
<div>
</div>
</div>
</div>
</div>
<div style="padding-top: 60px;">
<div style="width: 680px;">
<div>
<!-- YouTube Video -->
<iframe width="640" height="360" src="https://www.youtube.com/embed/sK5eschuK0U?feature=player_embedded" frameborder="0" allowfullscreen></iframe>
</div>
<!-- Facebook SDK include -->
<div id="fb-root"></div>
<script src="//connect.facebook.net/en_US/all.js#appId=224597957564170&amp;xfbml=1"></script>
<!-- Facebook Like Button -->
<div>
<fb:like href="https://www.youtube.com/watch?v=sK5eschuK0U" send="true" width="640" show_faces="true" font=""></fb:like>
</div>
<!-- Facebook Comments -->
<div>
<fb:comments href="https://www.youtube.com/watch?v=sK5eschuK0U" num_posts="5" width="640"></fb:comments>
</div>
</div>
</div>
<script>
</script>
</body>
</html>
view raw facebook_social_video.php hosted with ❤ by GitHub

The major components on this page (youtube video, facebook plugins) are easy to integrate from elsewhere – for example, you can copy the embed code from YouTube by right-clicking on a video and selection “Copy Embed Code”. Facebook lets you use a code builder to customize the Like and Comment plugins, which you can then copy-and-paste too.

Only the styling and structural components on this page required hand-coding. Try changing the YouTube video, or the location of the Like / Comments to see just how easy it is to modify the code.

Facebook, Facebook Social Plugins, YouTube

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

StackExchange / StackOverflow

profile for Niraj Shah on Stack Exchange, a network of free, community-driven Q&A sites

Subscribe for updates

Support Me

Buy Me a Coffee

PSN Profile

Tags

ACL Amazon Web Services Android Android 4.4 KitKat Android 5.0 Lollipop Apache Backup Bug Command Line Cordova cPanel / WHM Facebook Facebook Graph API Facebook PHP SDK 4.0 Facebook Social Plugins Fan Page Flash Flat File Geolocation Google Nexus 5 Hacking HTML5 iOS JavaScript jQuery Laravel 5 Linux Mac OS MongoDB NodeJS Parse PDF PHP Plugin Portfolio PS4 Review Security Server SSH SSL Sysadmin Tutorial WordPress WordPress Plugins

© 2011-2026 Niraj Shah
  • Blog
  • Portfolio
  • WordPress
  • About Me
  • Contact Me
  • Privacy Policy