Facebook API. Change video thumbnail? - facebook

When you upload a video to facebook, it lets you specify a thumbnail you want to use out of the 10 it generates and offers you (In the edit settings). Is there a way to upload a video and have it change the thumbnail to one of their randomly generated thumbnails using the api instead of having to do it manually?

There is no way to directly tell Facebook to select one of those default thumbnails.
You can query the [api_url]/v2.3/[video_id]/thumbnails edge which gives you the 10 thumbnails that Facebook has extracted from the video, and then set one of those as the video thumb using the same edge yourself.
Refer to: https://developers.facebook.com/docs/graph-api/reference/video/thumbnails/

Related

How to add thumbnail to facebook scheduled LIVE VIDEO using API

I want to add thumbnail to facebook LIVE VIDEO using graph api. I saw some websites able to do that , they can add thumbnail to live video. there is no docs available to do that.
I tried to upload thumbnail to the live video attachment but not worked.
some website are able to add the thumbnail to the scheduled live video , see the above screenshot with thumbnail
As far as I know, there's no standard way of doing that. However, if you tried getting the data of the live video after the live stream has started, it will include an iframe that has the video ID in its source. So the process would be something like this:
Create the live video
Start the live stream
Get the live video data
Parse the iframe content and extract the value from the src attribute
Get the href query param from the extracted value
The last part of the href is the actual video ID that will show in feeds
Use that video ID to add the thumbnail
I would advise adding some latency before step #3 so that you can be sure that the video has been created in feeds.
USE THIS
https://developers.facebook.com/docs/graph-api/reference/live-video/#Creating
Include event_params: {"cover" : "<thumbnail url>"} in the request parameters
Cover photo won't show up in timeline. (You need to click on more and then click on events)

how to share animated gif on facebook

i'm going to create facebook app using javascript sdk.i want to create app which shroud be able to post animated gif .my idea arise after see this app and https://www.facebook.com/khalil.shr/app_212097992149339. it work 100 percent .
and another best example is https://www.facebook.com/photo.php?fbid=471334666225107&set=p.471334666225107&type=1 take a look this picture animated without clicking on it.i can't guess how it work ..i want a complete guide about that ..
There is no API which allows animated GIFs to be uploaded to Facebook - any you see on Facebook were uploaded while there was a bug in the image validation code and are only visible because the images were not retroactively removed
You can't upload an animated GIF to Facebook. There are however some ways to outsmart the system. For example, the 3 ways mentioned in Guide to Animated Gifs for Facebook. It says:
If you try to upload a GIF to Facebook, a still image of the first
frame will appear. However, there are three ways to try and outsmart
the system.
Make a Youtube video look like a GIF.
Use a third party app on Facebook like Animated Picture. For this app, you do not use your own files. There are hundreds
sorted out in different categories to choose from.
Post a link to the GIF. Yes, the still image will show up, but a description will accompany it. Yes, it may take more time, but
your friends will be curious as to what it entails.
But, if the GIF you want to upload is not a moving picture, it should
work just fine. If you have a GIF image that is a nonmoving image, you
should have no problem uploading it to Facebook. According to the
Facebook Developers page, GIFs are one of many file types allowed for
uploading to the platform. Other supported image file types include
JPG, PNG, PSD, TIFF, JP2, IFF, WBMP and XBM images.
Similarly, you can find many other workarounds to this on the internet.
there was a bug back in 2012 which allowed user to upload an animated .gif by renaming it to .jpg and then upload it as an image. This has been fixed , although you can still see the gifs that were uploaded before the fix.
NB: check uploaded date of all animated images in facebook, all of them are uploaded on or before year 2012
Looks like Facebook finally enabled the GIF support!
You can upload gif image to some 3rd party website (Gipfy or something else) and then upload this link to facebook - then it'll be displayed as animated GIF!
http://techcrunch.com/2015/05/29/facebook-confirms-it-will-officially-support-gifs/#.pfn8nn:CJC4
It is possible to publish a GIF through the Graph API, please see an example call below:
curl \
-X POST \
"https://graph-video.facebook.com/v2.8/{page-id}/videos" \
-F "access_token=<sanitized>" \
-F "source=fluffy_cat.gif" \
You can now post an animated Gif on facebook by posting it as a video. If you post it as a photo it will not be animate-able and will display the first frame only.
To post an animated gif from URL use this Graph API call:
POST /me/videos
access_token=<access token with "publish_actions" permission>
file_url=<url to file>
Alternatively you can replace me with another user or page identifier.
The best way to share an animated gif on Facebook, is to
Upload the GIF to an image hosting site that allows animated gifs, such as http://imgur.com or http://photobucket.com then
Get the direct URL to the image from that site
Post the URL to the GIF on Facebook
Remove the image preview, as that will be a still image, and people won't realise its an animated gif if they see a still image preview. Add text to the image's description that it is an animated GIF, and that they need to click the link to see the animation.
Pro Tip: If you want to be able to view animated GIFs directly on Facebook, without having to click the GIF links as mentioned in the method above. You can use a browser extension such as FB Purity : http://fbpurity.com as it has an option called "View Animated Gifs". When this option is turned on, whenever the extension sees a link to an animated GIF on the Facebook site, it automatically converts it to a fully working and moving Animated GIF, so you don't even need to click the link to see the animation.
Another method is to convert the animated Gif into a video file then upload that, as Facebook now autoplays Video files, just like animated gifs. One way to convert an animated GIF to a video file is to use the free, open source Virtual Dub software. Get Virtual Dub here http://www.virtualdub.org
Open your .gif as a video file in Virtual Dub... then save as .avi then upload the new file to Facebook.
Though you can search google for other methods of converting animated gifs to video files if you dont want to use Virtual Dub.
There are also some other alternative methods listed here:
https://superuser.com/questions/5730/how-do-i-convert-an-animated-gif-to-a-youtube-friendly-video-format
If you want to do it from your own site you must have verified (green lock icon)secure layer socket SSL installed certificates. Then just go to Facebook debug and add the link. EASY!

Facebook Unity Upload Image w/ Facebook Dialog

We currently allow users to post images to their FB wall by using FB.Feed() with a URL of existing images on our CDN and we can include a description, a link, caption, etc.. The interface for posting the image is great because it's built by Facebook and gives the ability to choose who sees it (friends, me only, etc.).
We now want to allow users the ability to post images of their creations in the game, which obviously can't be pre-taken images on our CDN, and we'd prefer avoiding the route of uploading all the images to our CDN then using FB.Feed().
I know it's possibly to upload an image using FB.API() but this requires us building a custom popup to allow the users to type what they want to say for the message of the image rather than using the built-in popup from FB.Feed() and it doesn't give the options of who sees the post and as far as I can tell, it doesn't let us add a link, description and caption.
TLDR: Is FB.API() the only way to UPLOAD an image to a user's wall? If so, this requires building a custom interface for it instead of using the built-in FB.Post() interface, right?
Thanks,
Colter
Edit: I didn't see this post until now, but it's a similar question but I want to know if there is the ability to add a description, link and caption to the image AND use the built-in FB interface.
Copy/paste from Brian Jew's comment above:
"There currently isn't a way to upload screenshots without FB.API(). It does sound like an interesting idea to have something like that for FB.Feed() though."

Creating a Post with a larger photo size

When using the Facebook Graph API and including a Picture with a post, the picture always appears as a small thumbnail. Is there a way to make the picture larger like it appears when you upload a photo and share it?
No, the size of that photo is controlled by facebook and the only thing you can do is playing around with the relative size of the photo you use so that it would look slightly bigger (you should use pictures with landscape layout as opposed to portrait to get a 'slightly' bigger photo.
The hack you can use to do that is what apps like Instagram and Path did: Each time someone uploads a photo, they upload the photo to an album named "Instagram/Path photos" and include the link to the original photo in the caption (in your case,the link to the original article).
However, in order to do that, you users must grant you additional permissions on Facebook and they may not like the idea of uploading photos to another album, so I (personally) wouldn't go that way.

iPhone OS: Posting an image + text "story" to a user's news feed through the facebook api

So what I am trying to do is post an image that has been created by a user on an iphone into that users newsfeed.
The functionality I am having a hard time understanding if it is possible:
Can I pass a local NSURL (or URL?)(to a png file that lives in the documents folder) through a JSON string and onto Facebook?
i want to mimic the action of a user going to his/her facebook page, clicking into the textfield for their newsfeeld, uploading an image by clicking the "photos" icon and selecting an image from a local disk and uploading it. I would also like to add some text into the post optionally.
I'm just getting started with the Facebook api and it seems pretty tough right now, any help would be appreciated. code examples appreciated.
Thanks,
Nick
You'll need to use a third-party image host like YFrog or roll your own image host. Facebook requires that all media attachments (including photos) be hosted on the public web. Even though they cache the images themselves, the URL that you send to them has to have its own public URL. Many of the popular Twitter image hosts have simple REST APIs to achieve this.
You can also use Facebook itself to host the image via their photo.upload API, if you don't mind two side-effects: it will appear in the user's photo albums, and the thumbnail is likely to appear in the stream twice (once representing the addition to the photo album, and the second in the actual stream story you publish). You can't currently get around this doubling artifact, but it will give you a stable host for the uploaded image.
Just to clarify this. I was actually able to pass and image directly from the iPhone without a third party but that was posting an image to a users photo album. There are I think two methods in the fbconnect api for posting one contains an extra argument for a data argument which can be an image. I'll post more details when I'm in front of the documentation.