React native rn fetch blob fs.readStream工作不正常
问题: 在react本机应用程序中,我使用了rn fetch blob fs.readstream。但是在读取流之后,stream.oned没有启动 我是这样用的React native rn fetch blob fs.readStream工作不正常,react-native,rn-fetch-blob,React Native,Rn Fetch Blob,问题: 在react本机应用程序中,我使用了rn fetch blob fs.readstream。但是在读取流之后,stream.oned没有启动 我是这样用的 options = { title: strings('picker.q-v-pick'), takePhotoButtonTitle: strings('picker.tphoto'), chooseFromLibraryButtonTitle: strings('picker.cgallery'
options = {
title: strings('picker.q-v-pick'),
takePhotoButtonTitle: strings('picker.tphoto'),
chooseFromLibraryButtonTitle: strings('picker.cgallery'),
cancelButtonTitle: strings('picker.cancel'),
mediaType: 'video',
durationLimit: question.question.duration,
videoQuality: Platform.OS === 'android' ? 'medium' : 'low',
storageOptions: {
skipBackup: true,
path: 'images',
},
};
ImagePicker.launchCamera(options, (response) => {
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.error) {
console.log('ImagePicker Error: ', response.error);
} else if (response.customButton) {
console.log('User tapped custom button: ', response.customButton);
} else {
RNFetchBlob.fs.readStream(response.path, 'base64').then((stream) => {
let bitData = '';
stream.open();
stream.onData((chunk) => {
// console.log(chunk);
bitData += chunk;
});
stream.onEnd(() => {
console.log('HIIi');
console.log(bitData, 'uuu');
});
// response['data'] = data;
// response['type'] = 'mp4';
// response['fileName'] = 'videomulti.mp4';
// setFileObject(response);
});
}
});
stream.open和onData函数正在启动,但是stream.OnEnd没有启动。有人能帮我解决这个问题吗?我对这件事一无所知。多谢各位