views:

205

answers:

1

Hello.

I would like to stream videos that reside at the webserver from within a ExpressionMediaPlayer control. The following results in a network error. I believe that the problem is with my Uri. I have the videos inside the 'ClentBin' folder. Can anyone tell me how this is done?

private void videoList_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             var selectedVideo = (Video)videoList.SelectedItem;        
             PlaylistItem item = new PlaylistItem();
            item.MediaSource = new Uri(@"/ClientBin/" + selectedVideo.FilePath,         UriKind.RelativeOrAbsolute);
            item.IsAdaptiveStreaming = false;
            ep.Playlist.Items.Add(item);
         }

Thanks!

+1  A: 

There can be a number of factors that contribute to a network error in the Expression Media Player. Here are some basic checks...

1. Check the video file itself Launch Windows Media Player, go to File > Open URL... and make sure you can play the video with the absolute URL, just to rule out any basic problems with the web server. (Note that this does not apply if you are working with Adaptive Streaming, which it doesn't appear you are.)

2. What does selectedVideo.FilePath contain? Is this a simple file name (i.e. MyVideo.wmv) or is it a relative file path? Forward or backward slashes?

3. Try it with an absolute static URI Just to rule out relative path issues with your app / web server / any virtual directory configuration, try:

item.MediaSource = new Uri(@"http://mysite.com/ClientBin/MyVideo.wmv", UriKind.Absolute); 

4. Remove the leading slash from /ClientBin/ Try just new Uri(@"ClientBin/" + selectedVideo.FilePath, UriKind.Relative); and see if the relative path is then correct.

routeNpingme