Manually set selection of VAST mediafile to highest quality

Topics: Windows 8 Xaml
Feb 28, 2013 at 11:19 AM
Hi,

we have a small concern regarding the MediaFile selection. I consistently see that the app selects the 3rd MediaFile in the list of assets in the VAST response, Is there a way we can force the player to select the 1st file in the list which has the best quality?

<MediaFiles>
<MediaFile delivery="progressive" type="video/mp4" bitrate="865" width="1024" height="576" scalable="true">
    <![CDATA[http://ads.adprovider.com/ads/assets/40dc2631-44f7-4dba-b7f6-2e4c7e148ada/5b4f8ea7-b95e-4524-80bb-1c583f6824ee.mp4]]>
</MediaFile>
<MediaFile delivery="progressive" type="video/mp4" bitrate="535" width="640" height="360" scalable="true">
    <![CDATA[http://ads.adprovider.com/ads/assets/40dc2631-44f7-4dba-b7f6-2e4c7e148ada/958d1fd2-d24f-4916-8d7a-71f13375b76d.mp4]]>
</MediaFile>
<MediaFile delivery="progressive" type="video/mp4" bitrate="355" width="640" height="360" scalable="true">
    <![CDATA[http://ads.adprovider.com/ads/assets/40dc2631-44f7-4dba-b7f6-2e4c7e148ada/db5607cd-c6c4-4beb-9659-22fd269fb593.mp4]]>
</MediaFile>
<MediaFile delivery="progressive" type="video/mp4" bitrate="266" width="480" height="270" scalable="true">
    <![CDATA[http://ads.adprovider.com/ads/assets/40dc2631-44f7-4dba-b7f6-2e4c7e148ada/7d438046-d768-4ec7-85f7-aa31070d5473.mp4]]>
</MediaFile>
<MediaFile delivery="progressive" type="video/mp4" bitrate="170" width="320" height="180" scalable="true">
    <![CDATA[http://ads.adprovider.com/ads/assets/40dc2631-44f7-4dba-b7f6-2e4c7e148ada/8e0f786d-4c0d-4233-b47c-1b2da2dcd9f2.mp4]]>
</MediaFile>
</MediaFiles>
Coordinator
Feb 28, 2013 at 6:18 PM
Yes, you can manually set AdHandlerPlugin.PreferredBitrate (note: unit is bps) and it will be used to select the MediaFile closest to that bitrate.

If you always want the highest one, just set it to int.MaxValue

Note: The AdHandler plugin is an object you create in code or Xaml in your app. You can also access it via:
using Microsoft.PlayerFramework.Advertising;
...
var adHandlerPlugin = mediaPlayer.GetAdHandlerPlugin();
adHandlerPlugin.PreferredBitrate = int.MaxValue;