I have a video's on my website and want to add Share button then users can share that video on Facebook.I can share only image.
Initiate FB appID code:
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
window.fbAsyncInit = function() {
FB.init({appId: '1500007870295396', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
Sample HTML code.
<button class="fbShare"
data-href="http://temp.pickzy.com/ccc/images/user_post/post-photo-1452022482-1.mp4"
data-width="500"
data-allowfullscreen="true"
data-autoplay="true">Share Video On FB</button>
Share the video script code.
<script>
$('.fbShare').click(function(e){
e.preventDefault();
FB.ui({
method: 'feed',
name: 'NAME OF YOUR VIDEO',
link: 'http://temp.pickzy.com/ccc/images/user_post/post-photo-1452022482-1.mp4',
picture: 'http://temp.pickzy.com/ccc/images/10.PNG',
caption: 'YOUR CAPTION',
description: 'YOUR DESCRIPTION',
});
});
</script>
Any idea? Or any other method to add this button on the website?