locked
PlayerFramework.Advertising Multiple MidrollAdvertisement support ? RRS feed

  • Question

  • 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.

                var player = this.getPlayerObject();
                var numPreRolls = window.appSettings.videoSettings.numPreRolls;
            
                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 midroll = new PlayerFramework.Advertising.MidrollAdvertisement();
                        midroll.source = this.createAdSource();
                        midroll.time = VideoData.video.adMarkers[i];
                        player.adSchedulerPlugin.advertisements.push(midroll);               
                }

    Thursday, December 13, 2012 7:29 PM

All replies

  • Hi, please post this question on the Player Framework discussion forum. Adding the source code for your function: createAdSource would also be helpful. The short answer is: yes, multiple midrolls are supported. I'm not sure if this is relevant but if your midrolls do not have unique times you should group them in a single AdSource object so they play back to back without any gaps.
    Thursday, December 13, 2012 8:45 PM
  • Thanks for reply !! I have posted question @ http://playerframework.codeplex.com/discussions/406702. Actually we do have unique times as this is media application. I have posted detailed code below as well as on Codeplex. If you get chance please have a look.

    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;
            },

    Thursday, December 13, 2012 9:18 PM
  • Hi Tim,

    I have a few midroll ads and they do not have unique times, and so its ends up that only one ad plays out of 3 midrolls.

    You have mentioned, to group them into a single adsource, I am using RemoteAdSource(WebRequest,AdType) to create the source, how can I use this to combine the ad sources ?

    Wednesday, January 15, 2014 1:28 PM