将个人 iTunes 库集成到 Objective-C 应用程序中的最佳方法是什么?
我想将 iTunes 库集成到我的应用程序中,以便用户可以创建一系列歌曲来连续播放一个小时,其中歌曲每小时都会变化。我应该没有问题创建播放音频文件的逻辑,我只是想知道访问和显示 iTunes 库 XML 文件内容的最佳方法,或者是否有任何其他方法来访问此数据。
编辑:澄清一下,我不是在谈论集成到 iOS 中。简单来说就是 OS X 平台。
I want to integrate the iTunes library into my application so the user can create a series of songs to play for a straight hour, where the song changes every hour. I should have no problem creating the logic for playing the audio files, I just was wondering the best approach to accessing and displaying the contents of the iTunes Library XML file or if there is any other methodology for accessing this data.
Edit: To clarify, I am not talking about integrating into iOS. Simply the OS X platform.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MPMusicPlayerController
MPMusicPlayerController
你有选择。 Apple 提供了几个操作系统版本之前的 iTunes 库框架。文档在这里 https://developer.apple.com/ Library/mac/documentation/iTunesLibrary/Reference/iTunesLibraryFrameworkReference/index.html
这是我从其他 stackexchange 类似问题的答案中找到的示例项目,https://github.com/zadr/iTunesLibraryExample
你应该看看相关的问题 - 我认为他们会为你回答更多,但基本上,你有这个框架,脚本桥接,或者自己解析 XML 或使用其他人的库(例如 EyeTunes)。我建议尝试一下 Apple 框架,并根据需要提交错误,以促使他们改进它。
至于实际的播放控制,取决于你是自己播放文件还是告诉 iTunes 播放它们 - 但你说你已经控制住了,所以除了指出 AVFile、AVAsset 等类和控制器之外,不会说什么与 Core Audio(除了 Quicktime 之外)相关的用于自己播放文件与使用脚本桥告诉 iTunes 这样做的比较。与 XML 文件一样,该框架更多的是用于读取 iTunes 数据而不是控制它。
You have options. There's the iTunes Library Framework from Apple, as of several OS versions ago. Docs are here https://developer.apple.com/library/mac/documentation/iTunesLibrary/Reference/iTunesLibraryFrameworkReference/index.html
Here's a sample project I found from other stackexchange answers to similar questions, https://github.com/zadr/iTunesLibraryExample
You should look at the related questions - I think they'll answer a lot more for you, but basically, you have this framework, scripting bridge, or parsing the XML yourself or with someone else's library, like EyeTunes. I'd suggest giving the Apple framework a shot and filing bugs as needed to prompt them to make it better.
As for actual play control, depends if you are playing the files yourself vs. telling iTunes to play them - but you said you have that under control, so won't say anything besides pointing out the AVFile, AVAsset, etc. classes and controllers related to Core Audio (in addition to Quicktime) for playing files yourself vs. using the scripting bridge to tell iTunes to do so. The framework is, like the XML file, more for reading iTunes data than for controlling it.