Cordova / Ionic框架,通过whatsapp发送/共享音频文件

问题描述 投票:0回答:1

[我是Cordova / Ionic的新手,我已经成功使用ng-cordova包装的NativeAudio插件通过我的应用程序重现了mp3文件。我已经安装了CordovaSocial插件,但是我不知道如何将音频文件发送到whatsapp。mp3在www / audio / bass.mp3

使用这些行,我可以复制mpfile

$scope.play = function(audioFile) {
$cordovaNativeAudio.preloadSimple(audioFile, 'audio/' + audioFile + '.mp3');

$cordovaNativeAudio.play(audioFile);
}

这里是我的代码

在html文件中类似

<div class="buttons" ng-click="shareViaWhatsApp(null,null,'audio/bass.mp3')">
    <button class="button">Whatsapp</button>
</div>

并且在js文件中

$scope.shareViaWhatsApp = function(message, image, link) {
    $cordovaSocialSharing.canShareVia("whatsapp", message, image, link).then(function(result) {
  $cordovaSocialSharing.shareViaWhatsApp(message, image, link);
  //$cordovaSocialSharing.shareViaWhatsApp('test message', null, null); //this works

}, function(error) {
  alert("Cannot share on WhatsApp " + error);
});

我尝试通过whatsapp发送mp3文件时得到URL_NOT_SUPPORTED

ionic-framework cordova-plugins ngcordova
1个回答
0
投票

这里有更新吗?

我在这里有同样的问题

© www.soinside.com 2019 - 2024. All rights reserved.