cannot play .wmv file

Oct 6, 2011 at 7:22 PM

Hi All,

I am trying to use the smfplayer to play some .wmv videos but it just will not work and i can figure out what I am doing wrong

Here is the XAML:

        <Core:SMFPlayer x:Name="player" Grid.Row="0" AutoPlay="False" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" SeekWhileScrubbing="True" StartMuted="False">
                <Media:PlaylistItem x:Name="media" DeliveryMethod="Streaming" VideoStretchMode="Fill" />

 And here is the code:

 public void SetMediaSource(string path)
            if (player.PlayState == Microsoft.SilverlightMediaFramework.Plugins.Primitives.MediaPluginState.Playing)
            player.VolumeLevel = 1.0;
            if (player.Playlist.Count > 0)

            PlaylistItem item2 = new PlaylistItem();
            item2.DeliveryMethod = Microsoft.SilverlightMediaFramework.Plugins.Primitives.DeliveryMethods.Streaming;
            item2.MediaSource = new Uri("http://mahinename/videos/test.wmv");
            player.Playlist.Insert(0, item2);
            System.Diagnostics.Debug.WriteLine("media to play: " + item2.MediaSource.ToString());

The file plays fine in IE via WMP, but in my silverlight application, the smfplayer does not play it, or even try to play it (the button is still display as play, rather than pause)... So i am not sure why this will not work.

If anyone can spot what is wrong with this I would really appreciate it.



Dec 13, 2011 at 4:23 PM

I'm also having the same problem with an mp4. I can add a PlaylistItem in XAML, but not in C#.

Dec 13, 2011 at 5:05 PM

Try adding this after your call to Playlist.Insert():


Dec 13, 2011 at 5:14 PM

breynolds72 is correct. fyi: Another option is to create a new playlist (not just a playlistitem) and assign it to SMFPlayer.Playlist. The reason this second option works is there is a property called AutoLoad (default true) that will automatically loads the current playlistitem when a new playlist is assigned. This behavior isn't triggered when you add a new item to the existing playlist.

Regards, Tim