Video's is not being loaded completely with getInfoAsync (Not full size) expo

  1. SDK Version: 4.0.17
  2. Platforms(Android/iOS/web/all): IOS 14.4

Hello everyone,

I’m using the following code to get my video, and upload it to S3.
And the uploading kinda of works, but it only uploads/finds like 200kb(1 frame basically) of the video ,that is way bigger than that.

Originally i have this Object, which contains the "“assets-library:” url for the file.
Then i go and copy from this path to my cached directory, and from this point on we can access the files information.

                            let newId = makeid(10) + "." + uploadItem.filename.split('.').pop();;
                            const path = FileSystem.cacheDirectory + newId
                            await FileSystem.copyAsync({
                                from: uploadItem.uri,
                                to: path
                            }).then(() => {
                                console.log("File has been copied")
                            }).catch((err) => {
                                console.log("error", err)

                            let file = await FileSystem.getInfoAsync(path, { md5: true, size: true });
                            if (file) {

From this i get the following result:

Object {
  "exists": true,
  "isDirectory": false,
  "md5": "fb625b55365479e8e6fcab6d74b0160f",
  "modificationTime": 1612486372.300014,
  "size": 206711,
  "uri": "file:///var/mobile/Containers/Data/Application/69397E6D-5F90-4B8B-A378-ADF7D755D034/Library/Caches/ExponentExperienceData/%2540anonymous%252Fbibbu-30d91604-3fd6-4f5b-9efd-eebae9bc85e1/XVTYW6LIVT.MP4",

The file is way smaller then if i upload directly to S3, so i dont understand what’s wrong, or what i might be doing wrong.

I would appreciate all the help i can get!

Best regards Daniel

Got around it.
If any one else have this issue in the future:

You can get the true localUri from the file by using MediaLibrary:

let itemId = '6174B47B-C445-4ED5-B071-F3041084708B/L0/001'
const info = await MediaLibrary.getAssetInfoAsync(itemId)
const uri = info.localUri // use this for upload
1 Like

Thanks for sharing the solution with the community, @danielmedvec. Really appreciate when people take time out of there day to help out others.


This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.