views:

30

answers:

1

Hi , When I try to play a Audio file , on http severr from silverlight code behind, unable to do so:

string mediaFileName = "http://myserverIP/file.mp3";
musicPlayer.Source = new Uri("mediaFileName", UriKind.Relative);
LayoutRoot.Children.Add(musicPlayer);
musicPlayer.Play();

Now this should play the files easily. I dont understand why this is not happening. Insted of the webfile if I am placing the file inside Clientbin, it works pretty well.

Again when I try to play the web file from XAML like below,it works:

<MediaElement x:Name="mediaPlayer" Source="http://myserverIP/file.mp3" BindingValidationError="mediaPlayer_BindingValidationError" />

Please help.

Thanks, Subhen

A: 

M sorry , Really Sorry , did a Silly Mistake.

musicPlayer.Source = new Uri("mediaFileName", UriKind.Relative); 

Above, I passed mediaFileName as string again.

This should be as below:

 musicPlayer.Source = new Uri(mediaFileName, UriKind.Relative); 
Subhen