Home iOS App that processes audio messages from whatsapp
Reply: 0

iOS App that processes audio messages from whatsapp

user1403
1#
user1403 Published in July 23, 2018, 1:29 pm

As part of an university course I'm developing an iOS app that should be able to receive audio-files from WhatsApp to store and replay them in the internal player of the app itself. I'm however new to app development on iOS and therefore would appreciate some help. So far I've created an action extension that can use WhatsApp as a host app.

import UIKit
import MobileCoreServices
class ActionViewController: UIViewController {

@IBOutlet weak var imageView: UIImageView!

override func viewDidLoad() {
    super.viewDidLoad()

if let inputItem = extensionContext!
    .inputItems.first as? NSExtensionItem {

  if let itemProvider = inputItem
  .attachments?.first as? NSItemProvider { 

    itemProvider.loadItem(forTypeIdentifier: 
      "public.file-url", options: nil){

        (item, error) in print (item as! NSURL)
                  }}}}}      

Now when printing the value of the NSItemProvider I'm getting an NSURL pointing to the audio file in the filesystem.

Something like:

file:///private/var/mobile/Containers/Data/Application/021373BF-7B21-411B-AC59-C7B48C9A5AAB/tmp/documents/66E7701E-0057-44CC-A0B2-6A4A40D2C9AD/2018-01-09-AUDIO-00000002.opus

I guess there must be a a way to grab the file and store it or replay it in the AVAudioPlayer. I'm just not sure how to accomplish that.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.359546 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO