Actualmente estoy teniendo un problema persistente con mi Iónica de la aplicación Nativa.
Estoy tratando de subir un archivo de vídeo a la base avanzada de almacenamiento, puedo manejar la grabación con los Medios de comunicación de la Captura:
"@iónica-nativo/medios de captura": "^5.36.0""
este momento tan bueno.. cuando intento cargar el archivo de nuevo a firestore el archivo siempre carga dañado... o el tamaño del archivo es de sólo 9Bytes!??
este es el código que estoy usando ahora:
this.mediaCapture.captureVideo({duration: 10, quality: 0}).then(
(data: MediaFile[]) => {
if (data.length > 0) {
let originname = data[0].fullPath.substr(data[0].fullPath.lastIndexOf('/') + 1);
let originpath = data[0].fullPath.substr(0, data[0].fullPath.lastIndexOf('/') + 1);
let alerta = this.alerts.create({
buttons: ['ok'],
message: this.file.externalDataDirectory
});
alerta.then(set => set.present());
this.file.copyFile(originpath, originname, this.file.externalDataDirectory, 'video.mp4')
.then(result =>{
//let video = (document.getElementById('myvideo') as HTMLVideoElement).src = result.nativeURL;
//let path =this.webview.convertFileSrc(result.nativeURL);
// this.video = path;
// let alert = this.alerts.create({
// buttons: ['ok'],
// message: path
// });
// alert.then(set => set.present());
// let videoname = path.substr(path.lastIndexOf('/') + 1);
// let videopath = path.substr(0, path.lastIndexOf('/') + 1);
const data = Filesystem.readFile({
path: result.nativeURL
})
.then(data =>{
let blob= new Blob([data.data], {type: 'video/mp4'});
let ref = this.storage.storage.ref().child('videoTests').child('video.mp4')
ref.put(blob).then(
result =>{
let url = this.storage.ref('/videoTests/'+588+'.mp4').getDownloadURL();
url.subscribe(result =>{
console.log(result);
let alert = this.alerts.create({
buttons: ['ok'],
message: result
});
alert.then(set => set.present());
})
})
NOTA: para el contexto he intentado utilizar de Archivo nativo readAsDataURL pero la promesa nunca se resuelve.. en la consola, yo lo veo de procesamiento, pero al final es justo pegado y nunca se resuelve..
- Iónica 6.16.3
- Angular Del Núcleo 12.1.1
- Nodo 14.15.0
cualquier ayuda u orientación es muy apreciado tengo días atascado en este punto ahora...
[SOLUCIONADO]