PlayerFramework.Advertising Multiple MidrollAdvertisement support ?

Topics: Windows 8 JavaScript
Dec 13, 2012 at 8:17 PM

Hi Guys,

Does "PlayerFramework.Advertising" supports multiple midrolladvertisement? I am having problem when user scroll to (seek) certain position on video. Video hangs and doesn't play anymore.

       setupAds: function (player) {
            var player = this.getPlayerObject();
            var numPreRolls = window.appSettings.videoSettings.numPreRolls;
            var numPostRolls = window.appSettings.videoSettings.numPostRolls;

            // this is an array
            var numMidRolls = window.appSettings.videoSettings.numMidRolls;
           
            while (numPreRolls-- > 0) {
                var preroll = new PlayerFramework.Advertising.PrerollAdvertisement();
                preroll.source = this.createAdSource();
                player.adSchedulerPlugin.advertisements.push(preroll);
            }
                       
            for (var i = 0; i < VideoData.video.adMarkers.length; i++) {
                var howManyAds = numMidRolls[i % numMidRolls.length];
                while (howManyAds-- > 0) {
                    var midroll = new PlayerFramework.Advertising.MidrollAdvertisement();
                    midroll.source = this.createAdSource();
                    midroll.time = VideoData.video.adMarkers[i];
                    player.adSchedulerPlugin.advertisements.push(midroll);
                }
            }

            while(numPostRolls-- > 0) {
                var postroll = new PlayerFramework.Advertising.PostrollAdvertisement();
                postroll.source = this.createAdSource();
                this.getPlayerObject().adSchedulerPlugin.advertisements.push(postroll);
            }

            AdHandlerPlugin.bind("adstarted", function () {
                global.common.log("adstarted");
            });
        },
        createAdSource: function () {
            var adSource = new Microsoft.PlayerFramework.Js.Advertising.RemoteAdSource();
            adSource.type = Microsoft.VideoAdvertising.VastAdPayloadHandler.adType;
            adSource.uri = new Windows.Foundation.Uri(VideoData.pageObject.videoAdURL);
            return adSource;
        },

Coordinator
Dec 14, 2012 at 4:51 PM

Hello, yes multiple mid-rolls are supported. I don't see anything wrong with your code but am unable to duplicate the problem. Would you be able to either send me a full repro or tell me how to modify the sample (vast.js) to demonstrate the problem. Here's what I tried in vast.js which worked correctly.

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("http://smf.blob.core.windows.net/samples/win8/ads/vast_linear.xml");

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("http://smf.blob.core.windows.net/samples/win8/ads/vast_linear.xml");
midrollAd1.time = 10;

var midrollAd2 = new PlayerFramework.Advertising.MidrollAdvertisement();
midrollAd2.source = new Microsoft.PlayerFramework.Js.Advertising.RemoteAdSource();
midrollAd2.source.type = Microsoft.VideoAdvertising.VastAdPayloadHandler.adType;
midrollAd2.source.uri = new Windows.Foundation.Uri("http://smf.blob.core.windows.net/samples/win8/ads/vast_linear.xml");
midrollAd2.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("http://smf.blob.core.windows.net/samples/win8/ads/vast_linear.xml");

var mediaPlayerElement = element.querySelector("[data-win-control='PlayerFramework.MediaPlayer']");
mediaPlayer = mediaPlayerElement.winControl;
mediaPlayer.adSchedulerPlugin.advertisements.push(prerollAd);
mediaPlayer.adSchedulerPlugin.advertisements.push(midrollAd1);
mediaPlayer.adSchedulerPlugin.advertisements.push(midrollAd2);
mediaPlayer.adSchedulerPlugin.advertisements.push(postrollAd);
Dec 14, 2012 at 8:41 PM
Edited Dec 17, 2012 at 7:04 PM

Thanks for looking into it !!

Can you please try one more test where you try to seek @ 25 seconds. So you are bypassing 10 and 20 second intervals for midroll? For me Ad will play for one of the midroll and video freezes. Is same happening for you can you please check? If you seek @ 15 seconds (> 10 and < 20) it will work as expected.

So here could be couple of things which could be possible. We are trying to enable midroll on DRM content. Below is the VAST

http://ad.ca.doubleclick.net/N6872/pfadx/Shaw_MOBILE-GlobalTV_Windows8/video;show=glee;sz=320x240;pr=win8;dcmt=text/xml

<VAST xsi:noNamespaceSchemaLocation="vast.xsd" version="2.0">
  <Ad id="21916511">
    <InLine>
      <AdSystem>GDFP</AdSystem>
      <AdTitle>video</AdTitle>
      <Description>video ad</Description>
      <Error>http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=videoplayfailed</Error>
      <Impression>http://pubads.g.doubleclick.net/pagead/adview?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=8BthRGaXvLs</Impression>
      <Creatives>
        <Creative sequence="1" AdID="dddd92067311">
          <Linear>
            <Duration>00:00:15</Duration>
            <TrackingEvents>
              <Tracking event="start">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=part2viewed</Tracking>
              <Tracking event="firstQuartile">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=videoplaytime25</Tracking>
              <Tracking event="midpoint">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=videoplaytime50</Tracking>
              <Tracking event="thirdQuartile">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=videoplaytime75</Tracking>
              <Tracking event="complete">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=videoplaytime100</Tracking>
              <Tracking event="mute">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=admute</Tracking>
              <Tracking event="unmute">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=adunmute</Tracking>
              <Tracking event="rewind">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=adrewind</Tracking>
              <Tracking event="pause">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=adpause</Tracking>
              <Tracking event="resume">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=adresume</Tracking>
              <Tracking event="fullscreen">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=adfullscreen</Tracking>
              <Tracking event="acceptInvitation">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=acceptinvitation</Tracking>
              <Tracking event="creativeView">http://pubads.g.doubleclick.net/pagead/conversion/?ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&sigh=rLgkAWcLAvw&label=vast_creativeview</Tracking>
            </TrackingEvents>
            <VideoClicks>
              <ClickThrough id="GDFP">http://pubads.g.doubleclick.net/aclk?sa=L&ai=BgseIOZzLUMP8HYaAngSz-oGADe-l7d0CAAAAEAEgADgAUOKUsN38_____wFY_5r68Uhg_aCZgegDggEXY2EtcHViLTUxNzg2MTk4MDQyOTQ0NDmyARh3d3cuZGNsay1kZWZhdWx0LXJlZi5jb226AQlnZnBfaW1hZ2XIAQXaASBodHRwOi8vd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tL8ACAuACAOoCKDY4NzIvU2hhd19NT0JJTEUtR2xvYmFsVFZfV2luZG93czgvdmlkZW_4AoHSHoADAZADpAOYA6QDqAMB4AQBoAYj&num=0&sig=AOD64_1pFf32907sHaDBvVJkCcexwd4MTQ&client=ca-pub-5178619804294449&adurl=http://google.ca</ClickThrough>
            </VideoClicks>
            <MediaFiles>
              <MediaFile id="GDFP" delivery="progressive" bitrate="878" width="852" height="480" type="video/mp4" scalable="false" maintainAspectRatio="false">http://vads.smdg.ca/video/133/210/15_VOD_BONES_G_MONDAYS_medium_16x9.mp4</MediaFile>
            </MediaFiles>
          </Linear>
        </Creative>
      </Creatives>
      <Extensions>
        <Extension type="geo">
          <Bandwidth>4</Bandwidth>
        </Extension>
      </Extensions>
    </InLine>
  </Ad>
</VAST>

What we are trying to do is try injecting ad @ interval of 802,1167,1508 seconds on DRM video. When you try to seek anything > 1167 that's when Ad plays and video hangs. If I seek position greater than 802 and less than 1167 it plays fine. I tried to put (hardcoded) ad url (http://smf.blob.core.windows.net/samples/win8/ads/vast_linear.xml) you provided in your sample code (xBox Ad) and it behaved same way hanging when I try to seek video @ multiple midroll ad. I hope this might help you. Please let me know if you need more information.