Reputation: 632
I'm new with Cordova/Ionic, I've managed to reproduce mp3 files with my app using NativeAudio plugin wrapped with ng-cordova. I have CordovaSocial plugin installed, but I can't figure out how to send audio file to whatsapp. the mp3 is in www/audio/bass.mp3
With these lines I can reproduce the mpfile
$scope.play = function(audioFile) {
$cordovaNativeAudio.preloadSimple(audioFile, 'audio/' + audioFile + '.mp3');
$cordovaNativeAudio.play(audioFile);
}
Here my code
in html file something like
<div class="buttons" ng-click="shareViaWhatsApp(null,null,'audio/bass.mp3')">
<button class="button">Whatsapp</button>
</div>
and in the js file
$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);
});
I get URL_NOT_SUPPORTED when trying to send mp3 file thru whatsapp
Upvotes: 0
Views: 1569