获取当前播放的歌曲名称和艺术家 [英] Get currently playing song title and artist

查看:34
本文介绍了获取当前播放的歌曲名称和艺术家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Windows Phone 7 中获取当前播放的歌曲名称和艺术家?我知道我必须使用 MediaHistory.NowPlaying 属性 但我不知道如何使用它.我试过了

How do I get the currently playing song title and artist in Windows Phone 7? I know I have to do it with the MediaHistory.NowPlaying Property but I couldn't figure out how to use this. I tried

string title = MediaHistory.Instance.NowPlaying.Title;

但即使在播放歌曲时它也会给我一个 NullReferenceException.

but it gives me a NullReferenceException even when a song is playing.

推荐答案

我找到了答案:

using Microsoft.Xna.Framework.Media;

string name = MediaPlayer.Queue.ActiveSong.Name;
string album = MediaPlayer.Queue.ActiveSong.Album.Name;

您可以获得更多有关播放歌曲的信息...

You can get much more information about the playing song like this...

这篇关于获取当前播放的歌曲名称和艺术家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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