• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Use WKSessionFile as Data for AVAudioPlayer?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Use WKSessionFile as Data for AVAudioPlayer?


  • Subject: Use WKSessionFile as Data for AVAudioPlayer?
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Wed, 08 Feb 2017 02:49:18 +0000

I am transferring an audio file from Apple Watch extension to iOS
application.

In the Extension:
func sendAudioFileProper(){
    WCSession.default().transferFile(saveURL as! URL, metadata: nil)
}

I create saveURL like this:

let fileManager = FileManager.default
let container =
fileManager.containerURL(forSecurityApplicationGroupIdentifier:
"group.net.ericd.WatchRecord")
let fileName = "audioFile.wav"
saveURL = container?.appendingPathComponent(fileName) as NSURL?

iOS application:

func session(_ session: WCSession, didReceive file: WCSessionFile)
{
    DispatchQueue.main.async
    {
        self.versionLabel.text = "We got a real audio file."
        self.versionLabel.textColor = UIColor.blue
       * // ? How do I use the file to instantiate an AVAudioPlayer?*

Now, I want to instantiate an AVAudioPlayer and play that sent file. I know
that it's received (didFinish file transfer fires in the Watch Extension).
How do I do that? I don't know how to make that file Data.

I am using an app group if that matters. Should I be saving the file when
received, then use it to create the AVAudioPlayer? If so, how should I do
that?
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Use WKSessionFile as Data for AVAudioPlayer?
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Received file from watch - how to play?
  • Next by Date: Re: Use WKSessionFile as Data for AVAudioPlayer?
  • Previous by thread: Received file from watch - how to play?
  • Next by thread: Re: Use WKSessionFile as Data for AVAudioPlayer?
  • Index(es):
    • Date
    • Thread