【发布时间】:2019-04-13 21:15:06
【问题描述】:
我想将视频路径 URI 转换为文件对象以上传到 Filebase 存储。但是在我选择了视频并打电话后
window.resolveLocalFileSystemURL(...)
它永远不会提醒 File 并且 uploadToFirebase() 不会调用。所以,我不知道该怎么做。
doGetPicture() {
// TODO:
// get picture from camera
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
mediaType: this.camera.MediaType.VIDEO,
}
this.camera.getPicture(options).then((_imagePath) => {
alert('got image path ' + _imagePath);
window.resolveLocalFileSystemURL(_imagePath, function (fileEntry) {
fileEntry.file(function (file) {
alert('got file! '+file);
console.log('File__++ ', file);
});
});
});
}
uploadToFirebase(file) {
// Create the file metadata
var metadata = {
contentType: 'video/mp4'
};
// Upload file and metadata to the object 'videos/test.mp4'
this.fbRef.child('videos/' + file.name).put(file, metadata);
}
谢谢
附言。我正在使用 Ionic v.4
【问题讨论】:
标签: typescript firebase ionic-framework ionic3