Extracting the smoothStreamingMediaElement from the SMF 2.1

Aug 26, 2010 at 12:02 PM

Hi all,

I'm wondering if it's possible and how to "extract" the smoothStreamingMediaElement from the framework.

My purpose is to isolate it into my project in order to access low level functions, Like Markers (as it clearly appears that markers don't work from SMF directly).

Thanks a lot for your answers.

 

Escotto

Aug 26, 2010 at 12:50 PM

Got the solutiion, if any interested in :

SmoothStreamingMediaElement mediaElementFromSMF = SMFPlayer.MediaPresenterElement.Content as SmoothStreamingMediaElement;

Aug 27, 2010 at 6:24 AM

Awesome! Thanks. I've been looking for a good way to do this.

Aug 27, 2010 at 2:01 PM

I didn't know you can get the Content property of a Silverlight control. Useful info.

Aug 27, 2010 at 11:35 PM
escotto wrote:

Got the solutiion, if any interested in :

SmoothStreamingMediaElement mediaElementFromSMF = SMFPlayer.MediaPresenterElement.Content as SmoothStreamingMediaElement;

 I am not able to get this to work in the SMF 2.0.  Should it go in the loaded handler of MainPage.xaml.cs?  If not please explain.  Thanks! 

Aug 28, 2010 at 9:35 AM

Hi victor,

 

I'm using SMF V2.1, but I think there's no difference with SMF2.0

You have to call this code when the media is loaded. The best way to do that is to create a new class, extended to SMFPlayer

using Microsoft.SilverlightMediaFramework.Core;
using Microsoft.SilverlightMediaFramework.Core.Media;
using Microsoft.SilverlightMediaFramework.Plugins.Primitives;
using System.Windows.Controls.Primitives;
using System.Windows.Media.Imaging;
using Microsoft.Web.Media.SmoothStreaming;

namespace PlayerClasses
{
     public class SMFPlayerExtended : SMFPlayer
     {
        void SMFPlayerExtended_MediaOpened(object sender, EventArgs e)
        {
            mediaElement = this.MediaPresenterElement.Content as SmoothStreamingMediaElement;
        }
     }
}