I would like to share audio (.mp3) file via WhatsApp. I used UIActivityViewController but it just share mp3 files link not the file. How can i share the file to WhatsApp? There is my code:
@IBAction func playTusu(_ sender: Any) {
let url = URL(string: "https://freesound.org/data/previews/405/405511_2731495-lq.mp3")!
let playerItem = CachingPlayerItem(url: url)
playerItem.delegate = self
player = AVPlayer(playerItem: playerItem)
player.automaticallyWaitsToMinimizeStalling = false
player.play()
}
@IBAction func paylas(_ sender: Any) {
let url: [Any] = ["https://freesound.org/data/previews/405/405511_2731495-lq.mp3"]
let avc = UIActivityViewController(activityItems: url, applicationActivities: nil)
self.present(avc, animated: true)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
Thanks.