获取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 ...
随机推荐
- test20181024 nan
题意 nan 问题描述 我们有一个序列,现在他里面有三个数1,2,2.我们从第三个数开始考虑: 第三个数是2,所以我们在序列后面写2个3,变成1,2,2,3,3. 第四个数是3,所以我们在序列后面写3 ...
- 为什么 Windows 10 无论怎么设置一分钟后就自动关屏幕?
为什么 Windows 10 无论怎么设置一分钟后就自动关屏幕? 在设置中设置了很多方法,但不管怎么设置就是不行,不到一分钟一定关屏幕. 开始以为是能源之星引起,查了相关资料说不是,那个能源之星标志只 ...
- 【白银组】codevs_1011 数的计算
简单而言,就是递归的运用,注意使用全局变量统计cnt,并且注意递归的结束,中间生成的值无需进行输出. http://codevs.cn/problem/1011/ #include<iostre ...
- 堆排序算法-python实现
#-*- coding: UTF-8 -*- import numpy as np def MakeHeap(a): for i in xrange(a.size / 2 - 1, -1, -1):# ...
- 清理Visual Studio中VC++工程里不需要的文件
Visual Studio开发C++,工程的空间几M,几十M甚至几百M的长,生成的中间文件看的眼花缭乱,占空间不说,特别是备份拷贝代码时无奈的等待,有了这个脚本,好吧,整个世界清静了. @echo o ...
- Bootstrap-CL:徽章
ylbtech-Bootstrap-CL:徽章 1.返回顶部 1. Bootstrap 徽章(Badges) 本章将讲解 Bootstrap 徽章(Badges).徽章与标签相似,主要的区别在于徽章的 ...
- windows8.1中组件服务DCOM配置里属性灰色不可修改的解决办法
由于电脑升级,更换成了windows8.1的64位操作系统,今天遇到组件服务中DCOM配置里IIS Admin Service属性呈现灰色,不能修改. 查找官方文档,原来这是win8.1 x64的安全 ...
- MMO技能系统的同步机制分析
转自:http://www.gameres.com/729629.html 此篇文章基于之前文章介绍的技能系统,主要介绍了如何实现MMO中的技能系统的同步.阅读此文章之前,推荐首先阅读前一篇文章:一个 ...
- delete,truncate,drop的区别
操作 删除对象 表和索引的空间 是否回滚 时间 delete table和view的数据,可以使用where精确删除,删除会触发触发器 表或索引的空间不变化 是dml,可以rollback回滚 最慢 ...
- MVVMLight介绍以及在项目中的使用
http://www.des8.me/detail-1822826.html 一.MVVM 和 MVVMLight介绍 MVVM是Model-View-ViewModel的简写.类似于目前比较流行的M ...