获取iPod library中的媒体文件
【获取iPod library中的媒体文件】
The Media Player framework provides facilities for playing movie, music, audio podcast, and audio book files. This framework also gives your application access to the iPod library, letting you find and play audio-based media items synced from iTunes on the desktop. iPod library access is read-only.
As shown in Figure 1-1, your application has two ways to retrieve items. The media picker, shown on the left, is an easy-to-use, pre-packaged view controller that behaves like the built-in iPod application’s music selection interface. For many applications, this is sufficient.
If the picker doesn’t provide the specialized access control that you want, the media query interface—shown to the lower right of your application in the figure—will. It supports predicate-based specification of items from the device iPod library.

【媒体库的更新】
An MPMediaLibrary object, or media library, represents the state of the set of synced media items (such as songs) on a device. The complete library of media items itself is called the iPod library.
通过调用以下方法将会产生MPMediaLibraryDidChangeNotification消息,应用程序通过监听此消息以保持与媒体库的同步。

【API解读】
1、MPMediaEntity
The MPMediaEntity class serves as the abstract superclass for MPMediaItem and MPMediaItemCollection instances, and in turn for MPMediaPlaylist instances. As the superclass, MPMediaEntity defines methods used by those subclasses.

2、MPMediaItem:
A media item represents a single piece of media (such as one song or one video podcast) in the iPod library. A media item has an overall unique identifier, accessed using the MPMediaItemPropertyPersistentID property key, as well as specific identifiers for its metadata. These identifiers persists across application launches.
3、MPMediaItemCollection
A media item collection is a sorted set of media items (instances of the MPMediaItem class) from the iPod library.

4、MPMediaPropertyPredicate
Use one or more MPMediaPropertyPredicate objects, or media property predicates, to define the filter in a media query to retrieve a subset of media items from the iPod library.

5、MPMediaQuery
A media query specifies a set of media items (instances of MPMediaItem) from the iPod library by way of a filter and a grouping type. Filter and grouping type are both optional; an unqualified query matches the entire library.

【示例代码】
MPMediaQuery *everything = [[MPMediaQuery alloc] init]; NSLog(@"Logging items from a generic query...");
NSArray *itemsFromGenericQuery = [everything items];
for (MPMediaItem *song in itemsFromGenericQuery) {
NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle];
NSLog (@"%@", songTitle);
}
获取iPod library中的媒体文件的更多相关文章
- 获取SD卡中的音乐文件
小编近期在搞一个音乐播放器App.练练手: 首先遇到一个问题.怎么获取本地的音乐文件? /** * 获取SD卡中的音乐文件 * * @param context * @return */ public ...
- ios学习:AVAudioPlayer播放音乐文件及读取ipod库中的音乐文件
首先要导入AVFoundation框架及 #import <AVFoundation/AVFoundation.h>头文件 注意:要在真机上调试 下面是ipad上的调试效果 下面是代码,代 ...
- 教你如何获取ipa包中的开发文件
教你如何获取ipa包中的开发文件 1. 从iTunes获取到ipa包 2. 修改ipa包然后获取里面的开发文件
- WPF中播放声音媒体文件
这段时间我们小组要给部门的Annual Meeting準备一个WPF的抽奖程序,为了增加程序的有趣性,我们在程序中需要播放背景音乐等.由於对之前从未使用过WPF,所以对其中的声音等媒体文件播放不是很清 ...
- 从MediaStorehe和sd中删除媒体文件
参考资料:http://www.sandersdenardi.com/querying-and-removing-media-from-android-mediastore/ 从媒体表中删除: pri ...
- Django (七) token&静态文件&媒体文件
token&静态文件&媒体文件 1. token 1. 会话技术 2. 服务端会话技术 3. 它实际上就是手动实现的session 4. 实现token 4.1 在models.py中 ...
- 与众不同 windows phone (37) - 8.0 文件系统: StorageFolder, StorageFile, 通过 Uri 引用文件, 获取 SD 卡中的文件
[源码下载] 与众不同 windows phone (37) - 8.0 文件系统: StorageFolder, StorageFile, 通过 Uri 引用文件, 获取 SD 卡中的文件 作者:w ...
- WP8.1开发中关于媒体(图片)文件的生成操作,属性如何设置(内容/嵌入资源等);
(转载)WindowsPhone问题笔记-- 正确选择build action 解决媒体资源无法读取问题 链接:http://www.cnblogs.com/qinxg/archive/2012/07 ...
- 背水一战 Windows 10 (91) - 文件系统: Application Data 中的文件操作, Application Data 中的“设置”操作, 通过 uri 引用 Application Data 中的媒体
[源码下载] 背水一战 Windows 10 (91) - 文件系统: Application Data 中的文件操作, Application Data 中的“设置”操作, 通过 uri 引用 Ap ...
随机推荐
- JavaScript decodeURI()与decodeURIComponent() 使用与区别
decodeURI()定义和用法:decodeURI()函数可对encodeURI()函数编码过的URI进行解码.语法:decodeURI(URIstring)参数描述:URIstring必需,一个字 ...
- 排列算法(reverse...rotate...next_permutation)
#include <iostream> #include <algorithm> #include <cstring> using namespace std; i ...
- RHEL6安装Oracle 11g R2
收藏PDF版质料请点这里:http://download.csdn.net/detail/jifeng3518/6464999 1.使用DVD做yum源1.1.新建dvd挂载目录[root@oracl ...
- codevs 计算器的改良
#include<iostream> #include<cctype> #include<vector> #include<cstdio> using ...
- WebKit的已实施srcset图像响应属性
WebKit已经发布了一些官方新闻,终于落实srcset的属性.作为W3C的响应图像社区组的主席,我一直希望这一刻到来有一段时间了.所以,对所有参与方是个好消息,用户浏览网页时的体验是最重要的. 所有 ...
- FT5X06 如何应用在10寸电容屏
硬件搭起来看现象,如下图: 红色区域是FT5406上报有效数据的范围(1280*600),以左上角为原点 ,X轴方向上报数据的最大值1280,Y轴方向上报的最大数据是600..但是我用的LG的10.1 ...
- android基于adb的性能测试
应用CPU.内存.点亮.流量等数据,是应用测试的重要性能指标.本次以UC浏览器为例. 当前UC测试中,每个正式版本都会专门做一轮性能测试,测试数据包括: 1小时内存数据 1小时CPU数据 24小时电量 ...
- 在SUSE Linux Enterprise 11 SP1上用UDEV SCSI配置ASM
1. 编辑/etc/scsi_id.config文件,如果该文件不存在,则创建该文件,添加如下行: options=–whitelisted –replace-whitespace 2. 获取需要绑定 ...
- MySql 日期函数比较
查询当天数据 select * from tab where FROM_UNIXTIME(fabutime, '%Y%m%d') = 20121217; mysql TO_DAYS(date) 函 ...
- [Delphi] FMXUI - 沉侵式状态栏
好消息!FMXUI正式支持Android和IOS的沉侵式状态栏了. 先来看看效果图 安卓: IOS: 一.Android 沉侵式状态栏 FMXUI的沉侵式状态栏支持SDK版本大于21的Android系 ...