react-native-background-upload icon indicating copy to clipboard operation
react-native-background-upload copied to clipboard

[Android] When using this package with react-native-camera get {"framesToPop": 1, "code": EUNSPECIFIED}

Open watadarkstar opened this issue 6 years ago • 3 comments

I get this error on Android only when I try to upload a file using a uri from react-native-camera:

{"framesToPop": 1, "code": EUNSPECIFIED}

My upload code:

// Attempt to start file upload
  try {
    uploadId = await Upload.startUpload(options);
  } catch (e) {
    console.log("failing here");
    dispatch(messageFailed(uploadingMessage, I18n.t("messageFailedUpload"), e));
  }

My camera code:

startRecording = () => {
    if (this.camera) {
      this.camera
        .recordAsync({})
        .then(data => {
          console.log("data", data);
          this.props.upload(data.uri);
          this.navigateToChat();
        })
        .catch(err => console.error(err));
      this.setState({
        isRecording: true
      });
    }
  };

Not sure if this is a problem in this package or with react-native-camera. Any ideas as to what this error message means?

A workaround I have for now is: I copy the file using RNFS.copyFile(uri,dest) and use the destination uri (dest) and feed that to the uploader. But it would be nice if I could get rid of this workaround and just use the uri provided by react-native-camera.

watadarkstar avatar May 29 '18 14:05 watadarkstar

Any updates on this? Running into this issue as well

iworkinprogress avatar Oct 08 '18 01:10 iworkinprogress

Do you remove the file:// part from the path? For me, this resolved this issue.

Changed this:

const options = {
  path: videoFilePath,
  ...otherOptions,
}

const uploadId = await Upload.startUpload(options);

To this:

const options = {
  path: Platform.OS === 'ios' ? videoFilePath : videoFilePath.replace('file://', ''),
  ...otherOptions,
}

const uploadId = await Upload.startUpload(options);

APZelos avatar Feb 19 '19 13:02 APZelos

I've same issue (only on android 8+) and above workaround could not solve mine. Has anybody other suggestion?

react-native-background-upload: 5.1.0
react-native: 0.55.4

khodarahmi avatar Aug 19 '19 05:08 khodarahmi