Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdVideo example needed #25

Closed
aaronblondeau opened this issue Jan 15, 2018 · 2 comments
Closed

AdVideo example needed #25

aaronblondeau opened this issue Jan 15, 2018 · 2 comments

Comments

@aaronblondeau
Copy link

I am trying to figure out how to build a creative that uses a video. However, there aren't any docs or examples that show how to accomplish this. I tried the following based on a working AdImage function that I have

async function createAdVideo(accountId, filepath) {
  const AdAccount = adsSdk.AdAccount;
  const account = new AdAccount(accountId);
  const AdVideo = adsSdk.AdVideo;
  
  var video = await account
  .createAdVideo(
    [],
    {
      [AdVideo.Fields.filepath]: filepath
    }
  )
  
  return video
}

But all I ever get is "FacebookRequestError: Video Upload Time Out: Your video upload timed out before it could be completed. This is probably because of a slow network connection or because the video you're trying to upload is too large. Please try again."

@deltadanger
Copy link

Personally, I ended up doing the request myself for the video upload:

const upload_url = `https://graph-video.facebook.com/v2.11/${account.id}/advideos`;

const data = new FormData();
data.append('access_token', FACEBOOK_TOKEN);
data.append('title', video.name);
data.append('file', video);

return axios.post(upload_url, data, {
    headers: {
        'Content-Type': 'multipart/form-data'
    }
}).then(response => {
    return new AdVideo(response.data.id);
});

@codytwinton
Copy link
Contributor

It seems like this issue has been open for more than a few months now. We have made many changes in the SDK since then, including releasing a new version. If you can repro your specific issue with the latest version of the SDK, please create a new issue or comment here with further details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants