Uploading video progress returns 100 immediately

Hi @SocialPlus_Support, I would like to implement a progress bar to inform users about the status of video or image uploads. However, I’m facing an issue where the callback that returns the progress always returns 100% immediately, even though the video or image has not been uploaded yet.

Here is the code snippet I’m currently testing:

FileRepository.uploadVideo(postData, feedType, percent => {
    console.log('Uploading video percent: ', percent);
  })

And this is my ts sdk version: 6.4.5

Hello, could you please try updating the sdk version to the latest one? We tested and it functional as expected.

Hi @SocialPlus_Support , thanks for the response, I upgraded the ts sdk to the latest version (6.9.0), unfortunately I experienced the same issue. Do you any other recommendation? Thanks.

Hello, do you use our uikit or built your own ui?

Hi @SocialPlus_Support, I built my own UI

Hi Juan, If you get 100 percent right away and file data return as a response, that mean it has been uploaded successfully. However, If you only get the 100 percent, but no file data return back. Can you check your code that have you already put await before the function?

 const { data: file } = await FileRepository.uploadVideo(postData, feedType, percent => {
    console.log('Uploading video percent: ', percent);
  })

Hi @topAmity I used .then to ge the response, I attach my entire code snippet. Do you recommend async await?

const uploadVideoFile = async (data: FormData, feedType: Amity.ContentFeedType) => {
  return FileRepository.uploadVideo(data, feedType)
    .then(res => {
      return res.data?.length > 0 ? [res.data[0].fileId] : [];
    })
    .catch(e => {
      console.error('Uploading video: ', e);
      return null;
    });
};

Hello, yes, please use await.