How to control max download bitrate

Aug 25, 2010 at 5:38 PM

There is a control called MaxBitrateLimiterElement which has a slider to set max download bitrate. In my project I need to set this value from initParams. Is this possible and if so how can it be made?

Aug 25, 2010 at 8:17 PM

Hi piteerus;

This is how to get your values from the initparams in your app.cs file app startup event...  Put the values in as a resource...


<param name="initParams" value="MYKEY=MYVALUE"/>


         private void Application_Startup(object sender, StartupEventArgs e)
            if (e.InitParams != null)
                foreach (var item in e.InitParams)
                    this.Resources.Add(item.Key, item.Value);

            this.RootVisual = new MainPage();


To Get at em in your player


if (!ReferenceEquals(App.Current.Resources["MYKEY"], null))

                MYKEYVAR = App.Current.Resources["MYKEY"].ToString();


The BitrateMonitor CLASS has a property

BitrateMonitor..::.MaximumPlaybackBitrate Property

Gets or sets the highest bitrate for playback.
maybe this...  not familiar at all but maybe you could look into it....

Aug 26, 2010 at 8:20 AM

Yeah I now that, but BitrateMonitor is not a static class and when I create instance it's not linked with SMF. It is just instance outside of scope SMF. When video is opened there is a instance of MaxBitrateLimiterElement which has DownloadBitrate property. But when I set this property in MediaOpened event and subscribed to DownloadBitrateChanged event I was seeing how downlad bitrate is changeing some how.

This bulid in control to limit donwload bitrate (control which is displayed in top right corner) has a slider which don't work perfect, but after some time when I set it to minimum I see that quality is changing so this slider some how works. I need to achive the same with setting value from initParams.

Aug 26, 2010 at 12:06 PM
Sorry... not much else to say about that other than if the slider is setting a property value somewhere then you should be able to set it too... You should be able to pass the value through initparams like I mentioned before. Then look through the source for the binding on that slider or the setting of the slider value through code... If it is has an effect on bitrate like you say then it must be there somewhere to be set in code... It may not be associated with the player as it is more interested in the stream that is being fed to the player and not the player it's self.... My post may not be of much help but good luck with it just the same... Cheers; Brendon
Aug 26, 2010 at 12:19 PM

The SMFPlayer object also has a MaximumPlaybackBitrateProperty. So set this on your instance of SMFPlayer

Aug 26, 2010 at 12:29 PM

MaximumPlaybackBitrate property is read only.

Aug 26, 2010 at 12:35 PM
It Represents a property that can be set through methods such as, styling, data binding, animation, and inheritance. I would dig through the source... it has to be there somewhere...
Aug 26, 2010 at 3:28 PM

After some looking into code I've managed how to control of downloaded bitrates. The solution is simplier than I thought. Code is posted below.

 void CustomSMFPlayer_MediaOpened(object sender, EventArgs e)
            // Set donwloaded video bitrate
            if (downloadVideoBitrate > 0 && ActiveAdaptiveMediaPlugin != null)
                List<long> selectedTracks = AvailableVideoBitrates.Where<long>(i => i <= downloadVideoBitrate).ToList<long>();
                ActiveAdaptiveMediaPlugin.SetVideoBitrateRange(selectedTracks.Max(), selectedTracks.Max());


Variable "downloadVideoBitrate" is my value provided from initParams. My solution set max video bitrate from bitrates specified in manifest file and only this bitrate is downloaded. If you wish you can change first parametr of method "SetVideoBitrateRange" to 0 (zero), allowing player to download worse quality bitrate than specified in parameter.


Aug 26, 2010 at 3:48 PM
Hi piteerus; Thanks for sharing... this may come into use for myself as I am Streaming video over a SatCom and depending on cloud cover etc... the connection may be less than optimal... All the best... Brendon
Jun 14, 2013 at 4:32 AM
Thanks piteerus that works fine.

You found the solution in 2010 and I am implementing it in 2013 :)