'Video trim using react-native-video-processing

I am using react-native-video-processing for trimming or compressing local video from iOS device. when I try to trim video some time they trimmed well and some time give me warning shown as below and not trim my video.

Possible Unhandled Promise Rejection (id: 0): "Failed: Optional(Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-16357), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x6000019c3840 {Error Domain=NSOSStatusErrorDomain Code=-16357 "(null)"}})"

My packages versions are :

"react": "^17.0.2",
"react-native": "^0.67.4",
"react-native-video-processing": "^2.0.0",

My Code:

const openGallary = async() => {
try{
  const res = await DocumentPicker.pick({
    type: [DocumentPicker.types.video],
  });
       let Videodata = res[0].uri;

const options = {
startTime: isstarttime,
endTime: isendtime,
saveToCameraRoll: false, 
saveWithCurrentDate: false
};
const tempdata = await ProcessingManager.trim(Videodata, options);
console.log('tempdata: ', tempdata);
}catch (err) {
  if (DocumentPicker.isCancel(err)) {
  } else {
    throw err;
  }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source