Player Source...

Aug 11, 2010 at 3:35 PM


This has to be a stupid question but forgive me as I am new to c#  and I have looked everywhere I could think of...  Hopefully it is an easy answer for someone.... 

I have extended my the smfplayer to create a new player and have a couple of questions...

I do not want to use playlists...  Can I do this?

  I will get my media URL from a WCF webservice using C sharp...  so...

I have disabled playlist... myPlayer.PlaylistVisibility = Microsoft.SilverlightMediaFramework.Core.FeatureVisibility.Disabled;

now the player works great with playlist enabled but as I mentioned I do not want this functionality...  I want to use the play button PLAY routine to go and get the media URL at that time and then call after setting the media source...  is this do-able?

Here is the question....

How do i get access to the imediaplugin in order to set it's media source... or is this the right way to go about it?

I have tired everything I know to get the Source property in order to set it but I cannot find the answer...  I am missing something stupid I am sure but anyone's help would surely be appreciated...




Aug 11, 2010 at 3:37 PM

Sorry... had trouble posting...  kept getting errors...  ignore the also...  in this post...

Aug 11, 2010 at 4:12 PM
I would say that your best bet is to do the following 1. Wire up a method to the play click event that will call your wcf service to retrive the URL to play. 2. On return of the URL create a new PlaylistItem and assign the MediaSource to the URL and the DeliveryMethod. 3. Add that PlaylistItem to your Player.Playlist. If your player is set to AutoPlay it should play. The easiest way to get media playing is to use the Playlist methodology. Fortunately SMF allows you to intereact with the playlist via code which will allow you to accomplish what you need.
Aug 11, 2010 at 6:34 PM

Brendonr, I agree with what cchao has suggested, using the Playlist pattern from code is probably the best way to accomplish this.  I do not recommend attempting to gain access to the IMediaPlugin directly.  Another approach would be to extend from SMFPlayer and override the Play() method like this:


public class BrendonsPlayer : SMFPlayer


   public override void Play()


   //Create your PlaylistItem here...




Aug 12, 2010 at 12:56 PM
Hi and thanks for the answers... I still have an issue here though.... I am having trouble getting at playlist and playelement from my extended class... I have tried all sorts of permutations on base and parent and this and everything but i cannot get access to those items... here is a code sample that compiles fine and runs fine but does not effect the player at all... I am assuming i am doing something wrong here and hopefully you can provide some insight into this for me. I appreciate all your help on this to date and apologize if this something a veteran C# person might laugh at... :-) Here Goes with the code.. . This code is in the MYplayer class , Play method (Overridden as Kevin said)... I cannot get access to the parts of the player that I need like the playelement and the playlist. Hopefully it is just my lack of exposure to C#/SIlverlight and this is an easy fix for someone... Like I said.. it runs but doesn't work at all... Thanks again for your time and effort.... MainPage ppm = ((MainPage)Application.Current.RootVisual); ppm.MYPlayer.PlayElement.IsEnabled=false; ppm.MYPlayer.Playlist.Add(new Microsoft.SilverlightMediaFramework.Core.Media.PlaylistItem { MediaSource = new Uri("mms://"), DeliveryMethod = Microsoft.SilverlightMediaFramework.Plugins.Primitives.DeliveryMethods.Streaming, Title = "MMS Web Cam", Description = "WEB CAM", LiveDvrRequired = true }); All the Best; Brendon
Aug 16, 2010 at 7:18 PM

brendonr, it looks like you're trying to use "LiveDvrRequired" with an MMS stream.  MMS does not support "Live Dvr" so I recommend changing that value to false.  That might be part of the challenge.  Also, if you need to get access to the PlayElement from within a class that extends from SMFPlayer try base.PlayElement.

Aug 17, 2010 at 2:56 PM
Hi and thanks... again... I removed the livedvrrequired as it was left over from previous testing..... I appreciate the help...