简体   繁体   中英

How to post Video with custom thumbnail picture using RestFB?

I can publish video with description using RestFB. I want to add thumbnail picture to video. How can I do that?

I tried to add some Parameter when publish as

Parameter.with("thumb", BinaryAttachment.with(fileName, fetchBytesFromImage(fileName)))
Parameter.with("picture", BinaryAttachment.with(fileName, fetchBytesFromImage(fileName)))

If publishing more than one BinaryAttachment , you have to add the fieldname to the BinaryAttachment.with method , put both BinaryAttachments in a List and use it in the publish method.

It looks like this:

fbClient.publish("me/videos", GraphResponse.class,
      Arrays.asList(
          BinaryAttachment.with("source","1.mp4",inputstream), 
          BinaryAttachment.with("thumb", "bla.jpg", fetchBytesFromImage("bla.jpg"))),
      Parameter.with("description", "Test Thumb"));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM