Multiple Midroll Advertisement Causing Problems

Topics: Windows 8 JavaScript
Dec 17, 2012 at 7:41 PM

Hi Guys,

My current question is inline with post "". So here is my modified code for vast.js (Microsoft.PlayerFramework.Samples\Win8.Js.Samples\pages\itemdetail\advertising\vast\vast.js) from Microsoft sample ( I have highlighted changes with bold text.

Now problem comes when you try to seek video @ anything > 20 seconds. It plays Ad and it freezes. No exception nothing it just freezes. Interesting part is if you seek anywhere between (>15 and < 20) it will behave expected. It only when two midrolls clash we have observed this issue. Can you please help us figure out this issue?  This is delaying our app launch.

(function () {
    "use strict";

    var mediaPlayer = null;

    var prerollAd = new PlayerFramework.Advertising.PrerollAdvertisement();
    prerollAd.source = new Microsoft.PlayerFramework.Js.Advertising.RemoteAdSource();
    prerollAd.source.type = Microsoft.VideoAdvertising.VastAdPayloadHandler.adType;
    prerollAd.source.uri = new Windows.Foundation.Uri("");
    prerollAd.source.headers.insert("User-Agent", "Windows 8");

    var midrollAd = new PlayerFramework.Advertising.MidrollAdvertisement();
    midrollAd.source = new Microsoft.PlayerFramework.Js.Advertising.RemoteAdSource();
    midrollAd.source.type = Microsoft.VideoAdvertising.VastAdPayloadHandler.adType;
    midrollAd.source.uri = new Windows.Foundation.Uri("");
    midrollAd.source.headers.insert("User-Agent", "Windows 8");
    midrollAd.time = 15;

    var midrollAd1 = new PlayerFramework.Advertising.MidrollAdvertisement();
    midrollAd1.source = new Microsoft.PlayerFramework.Js.Advertising.RemoteAdSource();
    midrollAd1.source.type = Microsoft.VideoAdvertising.VastAdPayloadHandler.adType;
    midrollAd1.source.uri = new Windows.Foundation.Uri("");
    midrollAd1.source.headers.insert("User-Agent", "Windows 8");
    midrollAd1.time = 20;

    var postrollAd = new PlayerFramework.Advertising.PostrollAdvertisement();
    postrollAd.source = new Microsoft.PlayerFramework.Js.Advertising.RemoteAdSource();
    postrollAd.source.type = Microsoft.VideoAdvertising.VastAdPayloadHandler.adType;
    postrollAd.source.uri = new Windows.Foundation.Uri("");
    postrollAd.source.headers.insert("User-Agent", "Windows 8");

    WinJS.UI.Pages.define("/pages/itemdetail/advertising/vast/vast.html", {
        // This function is called whenever a user navigates to this page.
        // It populates the page with data and initializes the media player control.
        ready: function (element, options) {
            var item = options && options.item ? Data.resolveItemReference(options.item) : Data.items.getAt(0);
            WinJS.Binding.processAll(element, item);

            var mediaPlayerElement = element.querySelector("[data-win-control='PlayerFramework.MediaPlayer']");
            mediaPlayer = mediaPlayerElement.winControl;

        // This function is called whenever a user navigates away from this page.
        // It resets the page and disposes of the media player control.
        unload: function () {
            if (mediaPlayer) {
                mediaPlayer = null;

Dec 19, 2012 at 1:21 AM

Thank you for the great repro! It turns out there is an issue when seeking quickly past multiple midrolls (vs. scrubbing into them). I have already found the issue and will include the fix in the next release. If you need a solution immediately, please DM me.

Sorry you encountered this problem, Tim

Dec 19, 2012 at 3:27 PM

Thanks Tim !! Appreciate your efforts and quick fix. I have sent you message for getting fix early so that we can launch an App.

Jul 30, 2013 at 10:11 AM
Hi Tim, May i know is this issue fixed?
Jul 31, 2013 at 12:25 AM
@elliotchh, yes, this was released in v1.1 and all subsequent releases.
Jul 31, 2013 at 10:59 AM
Thx ~ :)