在iPhone上:找出目前正在播放的歌曲? (在iPod音乐播放器中) [英] On iPhone: Find out what song is currently playing? (in the iPod music player)

查看:223
本文介绍了在iPhone上:找出目前正在播放的歌曲? (在iPod音乐播放器中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple发布了访问iPod库在iPhone SDK 3.0中,我想知道现在是否可以理解当前正在播放哪首歌?标题,艺术家,专辑就足够了。示例:用户打开应用程序,应用程序可以知道后台正在播放哪首歌。

Apple released access to the iPod Library in the iPhone SDK 3.0 and I'm wondering if it's now possible to understand which song is currently playing? Title, Artist, Album suffices. Example: User opens an app and the app can know which song is playing in the background.

有没有人有这方面的经验?

Has anyone had any experience with this?

非常感谢!

推荐答案

MPMediaItem * song = [[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem];
NSString * title   = [song valueForProperty:MPMediaItemPropertyTitle];
NSString * album   = [song valueForProperty:MPMediaItemPropertyAlbumTitle];
NSString * artist  = [song valueForProperty:MPMediaItemPropertyArtist];

这篇关于在iPhone上:找出目前正在播放的歌曲? (在iPod音乐播放器中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆