From c151ba0c11479524d446e774e340dfe8c68b7f4c Mon Sep 17 00:00:00 2001 From: infinite-yy Date: Wed, 27 Jun 2018 10:08:22 +0800 Subject: [PATCH 1/2] modify videoUploader/VideoEncodingStatusChecker --- src/objects/ad-video.js | 2 +- src/video-uploader.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/objects/ad-video.js b/src/objects/ad-video.js index 8cf6db0b..527709f2 100644 --- a/src/objects/ad-video.js +++ b/src/objects/ad-video.js @@ -73,7 +73,7 @@ export default class AdVideo extends AbstractCrudObject { throw Error('Invalid Video ID'); } - VideoEncodingStatusChecker.waitUntilReady( + return VideoEncodingStatusChecker.waitUntilReady( this.getApi(), this['id'], interval, diff --git a/src/video-uploader.js b/src/video-uploader.js index 0109d132..fcb44765 100644 --- a/src/video-uploader.js +++ b/src/video-uploader.js @@ -428,8 +428,8 @@ class VideoEncodingStatusChecker { let status = null; while (true) { - status = VideoEncodingStatusChecker.getStatus(api, videoId); - status = status['video_status']; + status = await VideoEncodingStatusChecker.getStatus(api, videoId); + status = status['status']['video_status']; if (status !== 'processing') { break; @@ -450,7 +450,7 @@ class VideoEncodingStatusChecker { static getStatus (api: FacebookAdsApi, videoId: Number) { const result = api.call('GET', [parseInt(videoId)], {fields: 'status'}); - return result['status']; + return result; } } From c02b310c194fe385e18aa684dff723808a8d6e23 Mon Sep 17 00:00:00 2001 From: infinite-yy Date: Wed, 27 Jun 2018 11:02:02 +0800 Subject: [PATCH 2/2] update --- src/video-uploader.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video-uploader.js b/src/video-uploader.js index fcb44765..a566eadb 100644 --- a/src/video-uploader.js +++ b/src/video-uploader.js @@ -444,6 +444,8 @@ class VideoEncodingStatusChecker { if (status !== 'ready') { throw Error(`Video encoding status ${status}`); + }else{ + return status } }