Reputation: 3800
Im trying to play a video clip in my Silverlight Application
.
var video_path = "http://mydomain.com/path-to-media/file.wmv";
mediaPlayer.AutoPlay = true;
mediaPlayer.Source = new Uri(video_path);
mediaPlayer.Play();
MessageBox.Show(mediaPlayer.Source.ToString()); //test the source string
But the video does not start or even display.
Is there a step I have forgotten ?
mediaPlayer is a simple Silverlight MediaElement
Update When I attach a media Failed event and display the error exception i get
4001 AG_E_NETWORK_ERROR
Upvotes: 0
Views: 675
Reputation: 14037
It's because your silverlight application has a different URL scheme, and cross-scheme access is not allowed for media.
If the video URL starts from http://
, your application URL should start from http://
too.
I think your application URL looks something like file:///C:/project/page.html
. If so, you should add a ASP.Net website to your solution and host your Silverlight application there so that your URL looks like http://localhost:25252/page.html
.
Upvotes: 1