Hanaa Jebril

Hanaa Jebril

  • 1.8k
  • 30
  • 351

How to add thumb field to Facebook video

Oct 22 2017 7:46 AM
i created desktop application that upload videos to facebook using graph.facebook and it works ok, but when i try to add "thumb" field to upload request it return error "(OAuthException - #100) (#100) Invalid image format. It should be an image file data." .
here my code used :note coverpath is full image path and i try to path image as bytes but the same error return.
dynamic parameters = new ExpandoObject();         
parameters.source = new FacebookMediaObject                             
{                                 
ContentType = string.Format("video/{0}", VideoExtension.Split('.')[1]),
FileName = VideoName                             
} .SetValue(File.ReadAllBytes(filePath));         
parameters.title = VideoTitle;         
parameters.description = VideoTitle;                    
parameters.universal_video_id = new Guid();         
parameters.thumb = coverPath;         
parameters.published = false;         
parameters.unpublished_content_type = "DRAFT";         
dynamic uploadresult = fb.Post("/367728493684998/videos", parameters);