npm i com-badrit-base64 插件无法工作。

huangapple go评论43阅读模式
英文:

npm i com-badrit-base64 plugin is not working

问题

我正在使用Ionic框架与Capacitor。我需要将视频文件转换为base64字符串。我已经在我的Android和iOS上添加了以下插件。

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

我使用了以下代码将视频文件转换为base64:

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

在Android上,我们得到了结果。但是在iOS上,我们得到了以下错误:

[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

但是我们已经在iOS上安装了npm i com-badrit-base64插件。

有人可以帮我解决这个问题吗?

英文:

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.

答案1

得分: 0

我无法将视频文件转换为iOS的base64格式。因此,我通过API将视频文件发送到服务器。在下面找到链接:
https://stackoverflow.com/questions/75105158/upload-file-to-server-using-ionic-framework-and-web-api/75730281#75730281

英文:

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:
https://stackoverflow.com/questions/75105158/upload-file-to-server-using-ionic-framework-and-web-api/75730281#75730281

huangapple
  • 本文由 发表于 2023年2月8日 16:28:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75383042.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定