Skip to content

Conversation

@rickevry
Copy link

@rickevry rickevry commented Apr 23, 2017

This PR will not be merged, but it shows that there is a bug in how XMLHttpRequest loads a
video stream. Instead of uploading the video, it uploads the first frame (as an image).

This is the code that currently does not work:

<MediaPicker groupTypes={'All'} batchSize={25} maximum={15} assetType={'Videos'}           imagesPerRow={3} imageMargin={0} callback={(f)=> this.uploadFile(f[0])}  />

uploadFile(f) {
const file = { uri: f, name: "test.mp4", type: "video/mp4" }
const options = {
  keyPrefix: "uploads/",
  bucket: "xxxxxx",
  region: "eu-west-1",
  accessKey: "xxxxx",
  secretKey: "xxxxx",
  successActionStatus: 201
}

RNS3.put(file, options).then(response => {
  if (response.status !== 201)
    throw new Error("Failed to upload image to S3");
});
}

My implementation uses react-native-fetch-blob and works fine. 

RNS3.putWithFetch(file, options).then(response => {
  if (response.status !== 201)
    throw new Error("Failed to upload image to S3");
});
}

putWithFetch shows that there is a bug in how XMLHttpRequest loads a
video stream. Instead of uploading the video, it uploads the first
frame (as an image).
@Tzinov15
Copy link

Hi @rickevry , can you confirm that this PR will result in this library working with video upload as well? I've been using this library for months and had given up on being able to upload videos with it but if this PR fixes that then this is a godsend. Thanks!

@bz123
Copy link

bz123 commented Jul 25, 2017

It does work and it uploads the file to s3, but there is no promise returned out of it and you have no way to know if it happened, and the details of the item.

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

Successfully merging this pull request may close these issues.

4 participants