Search code examples
ionic-nativeionic6

npm i com-badrit-base64 plugin is not working


I am using ionic framework with capacitor. I need to convert video file to base64 string. I have added the following plugins on my android and iOS.

npm i com-badrit-base64
npm install @ionic-native/base64

I have used the following code to convert video file to base64:

var videobinary1=this.base64.encodeFile(retrievedFile.nativeURL).then(
                  (base64string:any) =>{
                  console.log('file base64 encoding: ' + base64string);
                });

For Android, We are getting the result. But iOS, We are getting the error like below:

[warn] - Native: tried calling Base64.encodeFile, but the Base64 plugin is not installed.
[warn] - Install the Base64 plugin: 'ionic cordova plugin add com-badrit-base64'
[log] - null
[error] - ERROR Error: Uncaught (in promise): plugin_not_installed

But We have install the npm i com-badrit-base64 plugin on iOS also.

Can anyone please help me to resolve this issue.


Solution

  • I can not convert the video file to base64 for iOS. So I send the video file to the server through API. Find the link below: upload file to server using ionic framework and web api