如何播放使用c#在线播放的歌曲用于Windows手机应用程序?

时间:2014-05-14 12:02:09

标签: c# xaml windows-phone-8

我有流媒体网址(http://stereo.wavestreamer.com:8894)。如何播放在此URL中在线播放的MediaElement中的歌曲以及如何获取艺术家姓名?

     I tried with the below code on button_click. Its not working.

    private void PlayBtn_Click(object sender, RoutedEventArgs e)
    {
        Player.Source = new Uri("http://stereo.wavestreamer.com:8894", UriKind.RelativeOrAbsolute);
        Player.Volume = 1.0;

        if (Player.CurrentState != MediaElementState.Playing)
        {
            Player.Play();
        } 

    }

1 个答案:

答案 0 :(得分:0)

您可以在this link上找到有关如何从应用中流式传输音乐的示例。

您需要VS 2012和Windows Phone 8 SDK才能打开它。

你应该能够这样做:

//You have to out your source link here to let the app work , enjoy :)  
Player.Source = new Uri("Your Link goes here", UriKind.RelativeOrAbsolute); 

if (Player.CurrentState != MediaElementState.Playing) 
{ 
    Player.Play(); 
}