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 = (Vide开发者_如何学运维o)videoList.SelectedItem;
PlaylistItem item = new PlaylistItem();
item.MediaSource = new Uri(@"/ClientBin/" + selectedVideo.FilePath, UriKind.RelativeOrAbsolute);
item.IsAdaptiveStreaming = false;
ep.Playlist.Items.Add(item);
}
Thanks!
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.
精彩评论