Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

How to upload mp4 file on firebase storage with ionic 3

$
0
0
const options2: CameraOptions = {
      sourceType: this.camera.PictureSourceType.SAVEDPHOTOALBUM,
      destinationType: this.camera.DestinationType.FILE_URI,
      mediaType: this.camera.MediaType.ALLMEDIA,
    }

    Camera.getPicture(options2).then((url) => {
      console.log('upload video start!!!!!')
      console.log(url);
      (window as any).resolveLocalFileSystemURL("file://"+url,FE=>{
        console.log(FE);
        FE.file(file=>{
          console.log(file);
          const FR=new FileReader()
          FR.readAsArrayBuffer(file)
          console.log(FR);

          FR.onloadend=((res:any)=>{
            console.log(res);
            let AF=res.target.result;
            console.log(AF);
            let blob=new Blob([new Uint8Array(AF)],{type:'video/mp4'});
            console.log(blob);
            firebase.storage().ref().child('video').put(blob).then(()=>{
              console.log('upload video end!!!!')
            })
          })
        })
      })

console.log(res);

res.target.result is output null.
then uploaded on storage, but 0 byte of data was uploaded.

Please let me know how to solve this problem.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>