0

I am trying to allow user to share video on my website to their facebook.

$data = [
    'title' => urldecode($_GET['c']),
    'description' => urldecode($_GET['t']),
    'source' => $fb->videoToUpload('video/video_1mb.mp4'),
];

$response = $fb->post('/me/videos', $data, $accessToken);

Above is the php code I used to post the video to their facebook. It works but I have some questions:

  1. I have some description and links (in the description) wants to share with the video to facebook. As facebook is not allowed to prefill sharing message in the post, how can I add description and links? I want the description and links show below the video. Just like sharing a youtube video to facebook. When you play the youtube video on facebook, there is some text below the video. Can I do the same things for facebook video?
  2. I know you can add a link at the end of the facebook video on facebook page. Can I do the same thing if I am sharing to personal account not page?
  3. I can get the like counter after getting the user login of their facebook account. But can I get the number of video view as well? I saw there is a insight but is it only working for facebook page?

Thanks, Alex

Alex Poon
  • 101
  • 4
  • 14
  • 1
    With that code you’re uploading the actual video, over and over again. What you actually want, is possible rather simply this: https://developers.facebook.com/docs/sharing/webmasters#video – CBroe Feb 18 '16 at 16:43
  • Yes. It will upload the video everytime. However, we want the video can be autoplay on facebook. And only facebook video support autoplay. So, I need to upload the video every time they share to facebook. – Alex Poon Feb 19 '16 at 01:39

1 Answers1

0

I finally change the whole way I did.

  1. I upload the video to facebook page as admin role
  2. I share the video post on the facebook page to personal wall

I found some reference to do #1

This show how to upload video to facebook page as admin. However, the access token he said is not permanent.

How to publish a post on a Facebook Fan Page as Page Owner or Admin in Graph API

This show you how to get a permanent access token for the page (this is a long steps for me!)

facebook: permanent Page Access Token?

After you posted the video to facebook page, it will return you a post id. The video on the facebook page has a permanent link like this:

https://www.facebook.com/{FACEBOOK_PAGE_ID}/videos/{POST_ID_FROM_THE_RETURN}

Now, you can share this link to your personal account using the facebook dialog or api if you want.

This make you able to upload video to facebook with description (and you can also add some links in the description if you want) without banned by the facebook prefill policy. And I think I can now add the "call to action" button to the end of the video and use the facebook page insight to check the view count.

Community
  • 1
  • 1
Alex Poon
  • 101
  • 4
  • 14