Player Source...

Aug 11, 2010 at 2:35 PM

Hi;

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 base.play() 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...

Also...

 

 

Aug 11, 2010 at 2:37 PM

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

Aug 11, 2010 at 3: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.
Coordinator
Aug 11, 2010 at 5: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...

   base.Play();

}

}

Aug 12, 2010 at 11:56 AM
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://127.0.0.1:8081"), DeliveryMethod = Microsoft.SilverlightMediaFramework.Plugins.Primitives.DeliveryMethods.Streaming, Title = "MMS Web Cam", Description = "WEB CAM", LiveDvrRequired = true }); All the Best; Brendon
Coordinator
Aug 16, 2010 at 6: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 1:56 PM
Hi and thanks... again... I removed the livedvrrequired as it was left over from previous testing..... I appreciate the help...