Buffering controls?

Topics: Windows 8 Xaml
Dec 7, 2012 at 11:51 PM

I'm probably missing something obvious, but I couldn't quite figure out how to control the buffer the player uses when playing back video.

Our app is consuming an SLSS stream from across the network, and buffering every 5-10 seconds.  Is there a way to programmatically enlarge the buffer the player uses internally?

Thanks!

Coordinator
Dec 9, 2012 at 10:56 PM

Hello, are you playing smooth streaming or progressive download? If progressive, there are currently no hooks in the MediaElement to control buffering (although you could create your own custom media foundation extension for more control). If using smooth streaming, there are APIs that are part of the smooth streaming SDK to help you control buffer size, ...etc. Please see this article for more information about how to access the smooth streaming API directly from your app when using the player framework.

Hopefully this helps, Tim

Dec 11, 2012 at 2:11 AM
Edited Dec 11, 2012 at 2:12 AM

Tim:

Thanks for the link.  Yes, the current scenario involves smooth streaming, but ideally the buffer would be settable regardless of the media source.

So I tried adding the following lines to my MediaPlayer object initialization.  With these lines, I see a C00D3634 error on playback (aka MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED).  Without these lines, my smooth streaming source plays fine (albeit buffering every so often, as mentioned above).

Thoughts?  I don't see a lot of documentation for this stuff, so I'm sure I'm missing something... 

AdaptivePlugin adaptivePlugin = new AdaptivePlugin(); 

this.videoPlayer.Plugins.Add(adaptivePlugin);

adaptivePlugin.Manager.AdaptiveSrcManager.SetBufferDelaySec(25);

 

 

 

Coordinator
Dec 13, 2012 at 7:59 PM

I think you need to wait until the stream is opened. Here's some code that works for me:

public SmoothPage()
{
    this.InitializeComponent();
            
    var adaptivePlugin = new AdaptivePlugin();
    player.Plugins.Add(adaptivePlugin);
    adaptivePlugin.Manager.Opened +=Manager_Opened;
}

void Manager_Opened(object sender, object e)
{
    var manager = sender as AdaptiveStreamingManager;
    manager.AdaptiveSrcManager.SetBufferDelaySec(25);
}