This is a small example of how to incorporate background music for a website in silverlight 2.0, which will have continous stream of music, where you shuld make sure the editing of music is in such a way that, you can feel as if it is continous.
Xaml code :
<MediaElement Height="34" Source="assets/bgmusic.mp3" MediaEnded="bgaudioplayer_MediaEnded" Position="0" HorizontalAlignment="Right" Margin="0,0,44,227" VerticalAlignment="Bottom" Width="32" x:Name="bgaudioplayer"/>
C# backend code :
private void bgaudioplayer_MediaEnded(object sender, RoutedEventArgs e)
{
bgaudioplayer.Position = System.TimeSpan.FromSeconds(0);
bgaudioplayer.Play();
}
Cheers!
Muthaiah
www.fmass.com
2 comments:
Your code doesnt work!!!
Hi this was with silverlight2 . May I know the version that you try?
Post a Comment