React Native 录制时如何获取视频时长

gg58donl  于 2023-03-31  发布在  React
关注(0)|答案(1)|浏览(174)

您如何获得视频在录制时已录制的时间量。
我在Google上寻找解决方案,但没有找到。

7gyucuyw

7gyucuyw1#

try{

let options = {
      mediaType: type,
      minWidth: 1000,
      minHeight: 1000,
      quality: 1,
      videoQuality: 'low',
      durationLimit: 30, //Video max duration in seconds
      saveToPhotos: true,
      // selectionLimit: 2,
    };
let isCameraPermitted = await requestCameraPermission();
    let isStoragePermitted = await requestExternalWritePermission();
    if (isCameraPermitted && isStoragePermitted) {
      launchCamera(options, response => {
        console.log('Response = ', response);

        if (response.didCancel) {
          // alert('User cancelled camera picker');
          return;
        } else if (response.errorCode == 'camera_unavailable') {
          // alert('Camera not available on device');
          return;
        } else if (response.errorCode == 'permission') {
          // alert('Permission not satisfied');
          return;
        } else if (response.errorCode == 'others') {
          // alert(response.errorMessage);
          return;
        }

      })
        .then(res => {
       console.log("Result:",res);
      }).catch(e=>console.log('e:',e));

}catch(err){
console.log("error:",err);
}

相关问题