访问iPod Library及MPMusicPlayerController
2014-02-15 18:22
295 查看
1.访问音乐库的两种方法,
(只能访问音频文件,如music,podcast,audiobook等)
2.MPMusicPlayerController的使用
有两种播放器可以选择,一种是application music player,另外一种是iPod music player。第一种播放器是一种内部播放器,当程序对出后停止播放;而第二种播放器则与iPod播放器内的信息相关,退出之后不会停止播放。获取方式如下:
+ applicationMusicPlayer
+ iPodMusicPlayer
播放之前需要设置播放器的播放队列
– setQueueWithQuery:
– setQueueWithItemCollection:
管理播放模式和播放状态的一些属性
currentPlaybackTime property
nowPlayingItem property
playbackState property
repeatMode property
shuffleMode property
volume property
播放状态 MPMusicPlaybackState
– play
– pause
– stop
– beginSeekingForward
– beginSeekingBackward
– endSeeking
– skipToNextItem
– skipToBeginning
– skipToPreviousItem
播放状态发生变化时可以发送通知
– beginGeneratingPlaybackNotifications
– endGeneratingPlaybackNotifications
MPMusicPlayerControllerPlaybackStateDidChangeNotification
可以通过该通知来改变播放按钮的样式
MPMusicPlayerControllerNowPlayingItemDidChangeNotification
MPMusicPlayerControllerVolumeDidChangeNotification
具体步骤
1.注册和开始发送通知
– setQueueWithQuery:
– setQueueWithItemCollection:
4.控制播放
3.MPMediaPickerController的使用
4.MPMediaItem
用此方法来获取item的metadataNSString *const MPMediaItemPropertyAlbumTitle;
NSString *const MPMediaItemPropertyArtist;
5.MPMediaItemCollection
collection是一组有序的item集合,可用同样的方法来获取collection的metadata+ collectionWithItems:
– initWithItems:
属性
items property
representativeItem property
count property
mediaTypes property
6.MPMediaPlaylist
7.MPMediaQuery
需要设置两个属性: filter and grouping typefilter描述查询内容,grouping type 描述返回内容的排列方式
查询可以获取items,也可以获取collections
When you ask for items, the query returns a collection containing all the items that match the filter. The items are in “natural” order, meaning that they are ordered as iTunes shows them on the desktop.
When you ask for collections, the media query employs not only its filter but also its grouping type.
获取全部歌曲
专辑封面的使用
相关文章推荐
- Fixflow引擎解析(四)(模型) - 通过EMF扩展BPMN2.0元素
- jbpm插件安装
- 报告显示:用户遇到Bug就会删掉应用
- 开始翻译《Beginning SharePoint 2013 Development》
- 《Beginning iOS 6 Development 》第九章--更细理解
- Getting Started in OS Development开发自己的操作系统
- 产品经理招聘潜台词
- PMD
- Activiti5基于jBPM4的开源工作流系统10分钟入门指南
- 《Beginning iOS 6 Development Exploring the iOS SDK》学习之问题(七、八、九、十)
- MPEG TS PMT 的 stream type
- 产品经理(PM)常用原型图设计工具
- 【转载】从假装在腾讯,到真的360 —— 一个应届准PM的独白(面经干货)
- Setting Up the Development Environment for SharePoint 2010 on Windows Vista, Windows 7, and Windows
- Code-First Development with Entity Framework 4
- 使用MPMediaPlayerController播放视频提示[NSURL initFileURLWithPath:]: nil string parameter错误的解决办法
- Ubuntu下使用ipmsg(飞鸽传书)
- JbpmUtil
- 产品经理一定要懂得“借力”
- 问题解决:《Beginning iOS 6 Development Exploring the iOS SDK》虚拟键盘交互