如何从UIDocumentPickerViewController Swift

时间:2019-07-15 14:07:14

标签: ios swift avaudioplayer icloud

我制作了一个简单的mp3播放器,该播放器具有播放,暂停和停止特定歌曲的功能。我有一首歌存储在iCloudDrive中。我成功检索了这首歌,没有错误并播放。我想获取有关歌曲的所有信息,例如“ BPM”。

代码:

func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {
    print("url = \(url)")
    //output = file:///Users/apple/Library/Developer/CoreSimulator/Devices/72506769-25BD-4508-9E6F-2FD59372473B/data/Library/Mobile%20Documents/com~apple~CloudDocs/Channa_Mereya.mp3
  BPMAnalyzer.init().getBpmFrom(url) { (songBPM) in 
  print(songBPM)
  //output = open error: Can't open this file.
   } 
 }

谢谢您的任何帮助。

0 个答案:

没有答案