how to share a video from my website on facebook like youtube

zeroonnet picture zeroonnet · Sep 19, 2013 · Viewed 20.4k times · Source

I have a website that has a HTML5 video player.

I want to share the link ( ex: http://site.com/video/example-2 ) on facebook and one the users click on the image of that post on the facebook it starts playing the video there.

Just like youtube videos and vimeo videos.

How can I do that?

Thanks

Answer

Adam Azad picture Adam Azad · Sep 19, 2013

I have a website that has a HTML5 video player.

You want to find a good SWF (*.SWF) video player that can stream video from url={video_Hot_link} (pass URL parameter to the SWF player)

Now after you got your SWF player ready for streaming some videos add Facebook Open Graph to your <head> tag like below:

<meta property="og:type" content="video"> <!-- site/page type more information http://ogp.me/ -->
<meta property="og:video:type" content="application/x-shockwave-flash"> <!-- you need this because your player is a SWF player -->
<meta property="og:video:width" content="Width in Pixels"> <!-- player width -->
<meta property="og:video:height" content="Height in Pixels"> <!-- player height -->
<meta property="og:video" content="http://example.com/{path_to}/{swf_player}.swf?url={video_soure}"> <!-- You will need to echo/print the video source (*.mp4) with server-side code -->
<meta property="og:video:secure_url" content="https://example.com/{path_to}/{swf_player}.swf?url={video_soure}"> <!-- required for users whom use SSL (actually Facebook forces everyone to use SSL so you're required to use og:video:secure_url) so get a one -->

Additionally, you need to add the following prefix to <html> likeso

<html prefix="og: http://ogp.me/ns#">