shahen94 / react-native-video-processing

Native Video editing/trimming/compressing :movie_camera: library for React-Native
https://shahen94.github.io/react-native-video-processing/
MIT License
1.25k stars 326 forks source link

Documentation for cropping video #274

Closed nica0012 closed 4 years ago

nica0012 commented 4 years ago

Hi, great library.

Everything seems to be documented except for cropping. It does exist in the source code and there are a few issues about it but it is missing from the docs. I am trying to implement a simple cropper for videos that exceed a square view (max height is the devices width).

I've tried messing around with some code found in the issues and have got it to crop uncontrollably, I just need some sort of reference if it exists...

Here is what I'm trying:

  cropVideo() {
    console.log(this.state.avatarSource)
    const options = {
      cropWidth: this.state.vidWidth,
      cropHeight: this.state.vidHeight,
       cropOffsetX: 0,
      cropOffsetY: this.state.vidHeight - this.state.ratio / 2,
      quality:"highest"
    };
      ProcessingManager.crop(this.state.avatarSource, options).then(data => {
      console.log('result', data);
      this.setState({ avatarSource: `file://${data}` })
    });
  }
nica0012 commented 4 years ago

@shahen94 Any way you can point me in the right direction with this?

hannojg commented 4 years ago

did you ever solve this @nica0012 ?