如何在 WP7 设备上获取歌曲、艺术家、专辑列表? [英] How to get a list of songs, artists, albums on WP7 devices?

查看:20
本文介绍了如何在 WP7 设备上获取歌曲、艺术家、专辑列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为 Windows Phone 7 创建一个简单的音频播放器.如何获得歌曲、艺术家、专辑、流派和播放我选择的项目的方法的列表?类似于原生 wp7 应用程序音乐+视频"

I want to create a simple audio player for Windows Phone 7. How can I get a list of songs, artists, albums, genres and method to play item which i selected ? something like is in native wp7 app "Music+Videos"

第二个问题:我从 代码下载了音乐 + 视频中心示例"样本,我执行这个项目,它播放一些歌曲,显示歌曲的标题和封面,但......当我复制此代码,向我的项目添加引用等时,不显示封面和显示歌曲标题,为什么?

second problem: I downloaded "Music + Videos Hub Sample" from Code samples, I execute this project and it play some song, display title and coverart of song BUT... when I copy this code, add references etc to my project then not display coverart and display title of song, why?

在哪里可以找到更多 wp7 媒体播放器示例?

Where i can find more samples of media player for wp7?

推荐答案

您可以使用 MediaLibrary 访问用户设备上的歌曲、艺术家和专辑.

You can use the MediaLibrary to access the songs, artists and albums on the user's device.

using(MediaLibrary library = new MediaLibrary())
{
     SongCollection songs = library.Songs;
     Song song = songs[0];
     MediaPlayer.Play(song);
}

对于您的第二个问题,您是否复制了插图以及代码和参考资料?除了您下载的示例之外,一些示例包括 this这个.MediaPlayer 并不是特别的复杂的类,它有基本的播放、停止、暂停等方法.第二个示例链接提供了一个音乐管理器,用于演示在使用 MediaPlayer 时如何处理某些事件(例如电话).

For your second problem, did you copy the artwork over as well as the code and references? Some samples, other than the one you've downloaded include this and this. The MediaPlayer isn't a particularly complex class, it has the basic play, stop, pause etc.. methods. The second sample link provides a music manager that demonstrates how to handle certain events (such as a phone call) when using the MediaPlayer.

这篇关于如何在 WP7 设备上获取歌曲、艺术家、专辑列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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