(function() {
				var checkJWReady = setInterval( function() {
					console.log("AMI jwp init jwplayer_dxnnpOwg_Bk5vyVYE_div");
					if ("undefined" !== typeof jwplayer ) {
						clearInterval(checkJWReady);
						if(typeof(jQuery)=="function"){(function($){$.fn.fitVids=function(){}})(jQuery)};
						var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
						var mHash = "ami" + decodeURIComponent( "dxnnpOwg" );
						window.jwpDef[mHash] = JSON.parse( decodeURIComponent( "%7B%22advertising%22%3A%7B%22admessage%22%3A%22This%20video%20will%20resume%20in%20xx%20seconds%22%2C%22adscheduleid%22%3A%224Z41klJD%22%2C%22autoplayadsmuted%22%3Afalse%2C%22bids%22%3A%7B%22bidders%22%3A%5B%7B%22invCode%22%3A%221922098%22%2C%22member%22%3A%221287%22%2C%22name%22%3A%22AppNexus%22%2C%22publisherId%22%3A2069834%7D%2C%7B%22id%22%3A%223522894%22%2C%22name%22%3A%22PubMatic%22%2C%22pubid%22%3A%22160545%22%2C%22type%22%3A%22OpenRTB%22%7D%2C%7B%22name%22%3A%22Rubicon%22%2C%22pubid%22%3A%229294%22%2C%22siteId%22%3A%22357204%22%2C%22zoneId%22%3A%221917914%22%7D%2C%7B%22id%22%3A%22264043%22%2C%22name%22%3A%22SpotX%22%7D%2C%7B%22id%22%3A%22123456%22%2C%22name%22%3A%22MediaGrid%22%2C%22pubid%22%3A%22pbGjPIU8%22%2C%22type%22%3A%22OpenRTB%22%7D%5D%2C%22settings%22%3A%7B%22bidTimeout%22%3A2000%2C%22buckets%22%3A%5B%7B%22increment%22%3A0.5%2C%22max%22%3A100%2C%22min%22%3A0.5%7D%5D%2C%22floorPriceCents%22%3A200%2C%22mediationLayerAdServer%22%3A%22dfp%22%7D%7D%2C%22client%22%3A%22googima%22%2C%22cuetext%22%3A%22Advertisement%22%2C%22enablePPS%22%3Afalse%2C%22endstate%22%3A%22suspended%22%2C%22outstream%22%3Afalse%2C%22preloadAds%22%3Afalse%2C%22rules%22%3A%7B%22startOnSeek%22%3A%22pre%22%2C%22timeBetweenAds%22%3A0%7D%2C%22schedule%22%3A%5B%7B%22offset%22%3A%22pre%22%2C%22tag%22%3A%22https%3A%5C%2F%5C%2Fpubads.g.doubleclick.net%5C%2Fgampad%5C%2Fads%3Fsz%3D320x240%26iu%3D%5C%2F4216%5C%2Fusweekly%5C%2Fpreroll%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dvast%26unviewed_position_start%3D1%26url%3D%5Breferrer_url%5D%26description_url%3D__page-url__%26correlator%3D%5Btimestamp%5D%26cust_params%3Dad%253D__item-tags__%2526featuredplayer%253Dyes%2526playerwidth%3D__player-width__%2526playerheight%253D__player-height__%26mediaID%3D__item-mediaid__%26mediaTitle%3D__item-title__%26mediaURL%3D__item-file__%26plcmt%3D2%22%2C%22type%22%3A%22linear%22%7D%5D%2C%22skipmessage%22%3A%22Skip%20ad%20in%20xx%20seconds%22%2C%22vpaidcontrols%22%3Atrue%2C%22vpaidmode%22%3A%22enabled%22%7D%2C%22aspectratio%22%3A%2216%3A9%22%2C%22autoPause%22%3A%7B%22viewability%22%3Atrue%7D%2C%22autostart%22%3Atrue%2C%22captions%22%3A%7B%22backgroundColor%22%3A%22%23000000%22%2C%22backgroundOpacity%22%3A75%2C%22color%22%3A%22%23FFFFFF%22%2C%22edgeStyle%22%3A%22none%22%2C%22fontFamily%22%3A%22sans-serif%22%2C%22fontOpacity%22%3A100%2C%22fontSize%22%3A15%2C%22windowColor%22%3A%22%23000000%22%2C%22windowOpacity%22%3A0%7D%2C%22controls%22%3Atrue%2C%22displayHeading%22%3Afalse%2C%22displaydescription%22%3Afalse%2C%22displaytitle%22%3Afalse%2C%22floating%22%3A%7B%22mode%22%3A%22notVisible%22%7D%2C%22generateSEOMetadata%22%3Atrue%2C%22height%22%3A260%2C%22hlshtml%22%3Atrue%2C%22include_compatibility_script%22%3Afalse%2C%22interactive%22%3Afalse%2C%22intl%22%3A%7B%22en%22%3A%7B%22advertising%22%3A%7B%22admessage%22%3A%22%22%2C%22cuetext%22%3A%22%22%2C%22skipmessage%22%3A%22%22%7D%2C%22related%22%3A%7B%22autoplaymessage%22%3A%22%22%2C%22heading%22%3A%22More%20Videos%22%7D%7D%7D%2C%22key%22%3A%22iZtDSmTbxJLZqGJZnyfzcNVDrq1ih4td4DoYbSSxoqPLAYAMnmhklw%3D%3D%22%2C%22logo%22%3A%7B%22hide%22%3Afalse%2C%22position%22%3A%22top-right%22%7D%2C%22mute%22%3Atrue%2C%22ph%22%3A2%2C%22pid%22%3A%22Bk5vyVYE%22%2C%22pipIcon%22%3A%22disabled%22%2C%22playbackRateControls%22%3Atrue%2C%22preload%22%3A%22metadata%22%2C%22related%22%3A%7B%22displayMode%22%3A%22shelf%22%2C%22file%22%3A%22%5C%2F%5C%2Fcontent.jwplatform.com%5C%2Fv2%5C%2Fplaylists%5C%2FSYLDtFu2%3Frelated_media_id%3DMEDIAID%22%2C%22oncomplete%22%3A%22hide%22%7D%2C%22repeat%22%3Afalse%2C%22setTimeEvents%22%3Atrue%2C%22skin%22%3A%7B%22controlbar%22%3A%7B%22background%22%3A%22rgba%280%2C0%2C0%2C0%29%22%2C%22icons%22%3A%22%23ec008c%22%2C%22iconsActive%22%3A%22%23f57fc5%22%2C%22text%22%3A%22%23ec008c%22%7D%2C%22menus%22%3A%7B%22background%22%3A%22%23333333%22%2C%22text%22%3A%22%23ec008c%22%2C%22textActive%22%3A%22%23f57fc5%22%7D%2C%22timeslider%22%3A%7B%22progress%22%3A%22%23f57fc5%22%2C%22rail%22%3A%22rgba%28255%2C255%2C255%2C0.3%29%22%7D%2C%22tooltips%22%3A%7B%22background%22%3A%22%23FFFFFF%22%2C%22text%22%3A%22%23ec008c%22%7D%7D%2C%22stretching%22%3A%22uniform%22%2C%22visualplaylist%22%3Atrue%2C%22width%22%3A%22100%25%22%2C%22playlist%22%3A%22https%3A%5C%2F%5C%2Fcontent.jwplatform.com%5C%2Ffeeds%5C%2FdxnnpOwg.json%22%2C%22plugins%22%3A%7B%22https%3A%5C%2F%5C%2Fsb.scorecardresearch.com%5C%2Fc2%5C%2Fplugins%5C%2Fstreamingtag_plugin_jwplayer.js%22%3A%5B%5D%2C%22https%3A%5C%2F%5C%2Fovp.iris.tv%5C%2Fplugins%5C%2Fjwplayer%5C%2Fv2%5C%2Firis-jwplayer8.adaptive.min.js%22%3A%7B%22settings%22%3A%7B%22client_token%22%3A%22nvonvsnnlg8c%22%2C%22platform_id%22%3A%22dxnnpOwg%22%2C%22player_id%22%3A%22jwplayer_dxnnpOwg_Bk5vyVYE_div%22%2C%22end_up_next%22%3Atrue%2C%22ssl%22%3Atrue%2C%22campaign_tracking%22%3Atrue%2C%22disable_mobile_upnext%22%3Afalse%7D%2C%22iris_buttons%22%3A%7B%22thumbs_up%22%3Afalse%2C%22thumbs_down%22%3Afalse%2C%22skip_forward%22%3Afalse%2C%22skip_back%22%3Afalse%2C%22skip_on_thumbs_down%22%3Afalse%7D%2C%22global%22%3A%22iris%22%2C%22jwCMS%22%3Atrue%7D%7D%2C%22nextUpDisplay%22%3Afalse%7D" ) );
						var videoParams   = JSON.parse( decodeURIComponent( "%7B%22advertising%22%3A%7B%22admessage%22%3A%22This%20video%20will%20resume%20in%20xx%20seconds%22%2C%22adscheduleid%22%3A%224Z41klJD%22%2C%22autoplayadsmuted%22%3Afalse%2C%22bids%22%3A%7B%22bidders%22%3A%5B%7B%22invCode%22%3A%221922098%22%2C%22member%22%3A%221287%22%2C%22name%22%3A%22AppNexus%22%2C%22publisherId%22%3A2069834%7D%2C%7B%22id%22%3A%223522894%22%2C%22name%22%3A%22PubMatic%22%2C%22pubid%22%3A%22160545%22%2C%22type%22%3A%22OpenRTB%22%7D%2C%7B%22name%22%3A%22Rubicon%22%2C%22pubid%22%3A%229294%22%2C%22siteId%22%3A%22357204%22%2C%22zoneId%22%3A%221917914%22%7D%2C%7B%22id%22%3A%22264043%22%2C%22name%22%3A%22SpotX%22%7D%2C%7B%22id%22%3A%22123456%22%2C%22name%22%3A%22MediaGrid%22%2C%22pubid%22%3A%22pbGjPIU8%22%2C%22type%22%3A%22OpenRTB%22%7D%5D%2C%22settings%22%3A%7B%22bidTimeout%22%3A2000%2C%22buckets%22%3A%5B%7B%22increment%22%3A0.5%2C%22max%22%3A100%2C%22min%22%3A0.5%7D%5D%2C%22floorPriceCents%22%3A200%2C%22mediationLayerAdServer%22%3A%22dfp%22%7D%7D%2C%22client%22%3A%22googima%22%2C%22cuetext%22%3A%22Advertisement%22%2C%22enablePPS%22%3Afalse%2C%22endstate%22%3A%22suspended%22%2C%22outstream%22%3Afalse%2C%22preloadAds%22%3Afalse%2C%22rules%22%3A%7B%22startOnSeek%22%3A%22pre%22%2C%22timeBetweenAds%22%3A0%7D%2C%22schedule%22%3A%5B%5D%2C%22skipmessage%22%3A%22Skip%20ad%20in%20xx%20seconds%22%2C%22vpaidcontrols%22%3Atrue%2C%22vpaidmode%22%3A%22enabled%22%7D%2C%22aspectratio%22%3A%2216%3A9%22%2C%22autoPause%22%3A%7B%22viewability%22%3Atrue%7D%2C%22autostart%22%3Atrue%2C%22captions%22%3A%7B%22backgroundColor%22%3A%22%23000000%22%2C%22backgroundOpacity%22%3A75%2C%22color%22%3A%22%23FFFFFF%22%2C%22edgeStyle%22%3A%22none%22%2C%22fontFamily%22%3A%22sans-serif%22%2C%22fontOpacity%22%3A100%2C%22fontSize%22%3A15%2C%22windowColor%22%3A%22%23000000%22%2C%22windowOpacity%22%3A0%7D%2C%22controls%22%3Atrue%2C%22displayHeading%22%3Afalse%2C%22displaydescription%22%3Afalse%2C%22displaytitle%22%3Afalse%2C%22floating%22%3A%7B%22mode%22%3A%22notVisible%22%7D%2C%22generateSEOMetadata%22%3Atrue%2C%22height%22%3A260%2C%22hlshtml%22%3Atrue%2C%22include_compatibility_script%22%3Afalse%2C%22interactive%22%3Afalse%2C%22intl%22%3A%7B%22en%22%3A%7B%22advertising%22%3A%7B%22admessage%22%3A%22%22%2C%22cuetext%22%3A%22%22%2C%22skipmessage%22%3A%22%22%7D%2C%22related%22%3A%7B%22autoplaymessage%22%3A%22%22%2C%22heading%22%3A%22More%20Videos%22%7D%7D%7D%2C%22key%22%3A%22iZtDSmTbxJLZqGJZnyfzcNVDrq1ih4td4DoYbSSxoqPLAYAMnmhklw%3D%3D%22%2C%22logo%22%3A%7B%22hide%22%3Afalse%2C%22position%22%3A%22top-right%22%7D%2C%22mute%22%3Atrue%2C%22ph%22%3A2%2C%22pid%22%3A%22Bk5vyVYE%22%2C%22pipIcon%22%3A%22disabled%22%2C%22playbackRateControls%22%3Atrue%2C%22preload%22%3A%22metadata%22%2C%22related%22%3A%7B%22displayMode%22%3A%22shelf%22%2C%22file%22%3A%22%5C%2F%5C%2Fcontent.jwplatform.com%5C%2Fv2%5C%2Fplaylists%5C%2FSYLDtFu2%3Frelated_media_id%3DMEDIAID%22%2C%22oncomplete%22%3A%22hide%22%7D%2C%22repeat%22%3Afalse%2C%22setTimeEvents%22%3Atrue%2C%22skin%22%3A%7B%22controlbar%22%3A%7B%22background%22%3A%22rgba%280%2C0%2C0%2C0%29%22%2C%22icons%22%3A%22%23ec008c%22%2C%22iconsActive%22%3A%22%23f57fc5%22%2C%22text%22%3A%22%23ec008c%22%7D%2C%22menus%22%3A%7B%22background%22%3A%22%23333333%22%2C%22text%22%3A%22%23ec008c%22%2C%22textActive%22%3A%22%23f57fc5%22%7D%2C%22timeslider%22%3A%7B%22progress%22%3A%22%23f57fc5%22%2C%22rail%22%3A%22rgba%28255%2C255%2C255%2C0.3%29%22%7D%2C%22tooltips%22%3A%7B%22background%22%3A%22%23FFFFFF%22%2C%22text%22%3A%22%23ec008c%22%7D%7D%2C%22stretching%22%3A%22uniform%22%2C%22visualplaylist%22%3Atrue%2C%22width%22%3A%22100%25%22%2C%22playlist%22%3A%22https%3A%5C%2F%5C%2Fcontent.jwplatform.com%5C%2Ffeeds%5C%2FdxnnpOwg.json%22%2C%22plugins%22%3A%7B%22https%3A%5C%2F%5C%2Fsb.scorecardresearch.com%5C%2Fc2%5C%2Fplugins%5C%2Fstreamingtag_plugin_jwplayer.js%22%3A%5B%5D%2C%22https%3A%5C%2F%5C%2Fovp.iris.tv%5C%2Fplugins%5C%2Fjwplayer%5C%2Fv2%5C%2Firis-jwplayer8.adaptive.min.js%22%3A%7B%22settings%22%3A%7B%22client_token%22%3A%22nvonvsnnlg8c%22%2C%22platform_id%22%3A%22dxnnpOwg%22%2C%22player_id%22%3A%22jwplayer_dxnnpOwg_Bk5vyVYE_div%22%2C%22end_up_next%22%3Atrue%2C%22ssl%22%3Atrue%2C%22campaign_tracking%22%3Atrue%2C%22disable_mobile_upnext%22%3Afalse%7D%2C%22iris_buttons%22%3A%7B%22thumbs_up%22%3Afalse%2C%22thumbs_down%22%3Afalse%2C%22skip_forward%22%3Afalse%2C%22skip_back%22%3Afalse%2C%22skip_on_thumbs_down%22%3Afalse%7D%2C%22global%22%3A%22iris%22%2C%22jwCMS%22%3Atrue%7D%7D%2C%22nextUpDisplay%22%3Afalse%7D" ) );

						console.log("AMI jwp params", videoParams);
						if ( videoParams.advertising ) {
							console.log("AMI jwp ad params", videoParams.advertising);
						}
						var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );
						if ( window.jwpDef[vHash].advertising ) {
							if ( window.jwpDef[vHash].advertising.schedule ) {
								if ( window.jwpDef[vHash].advertising.schedule[0].tag ) {
									if ( typeof window.jwVastTag[vHash] === "undefined" ){
										window.jwVastTag[vHash] = window.jwpDef[vHash].advertising.schedule[0].tag;
										var vastURL = new URL( window.jwVastTag[vHash] );
									    var vastParams = new URLSearchParams( vastURL.search );
									    var ui = vastParams.get( "iu" ).split( "/" );
									    window.prerollTag[vHash] = vastParams.get( "iu" );
									    window.prerollTag[vHash] = vastParams.get( "iu" );
									    window.jwpBids[vHash] = {};
									    console.log("AMI jwp", window.jwpBids);
									    console.log("AMI jwp prerolltag", window.prerollTag[vHash]);
									    console.log("AMI jwp GAM Tag", window.jwVastTag[vHash]);
									}
								}
							}
						}
						function performAsyncBidding(player, item, index) {
							var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
							var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );
							let url = window.jwVastTag[vHash];

							var utms = {};
						    if ( adsParseUrlParams( "utm_source" ) || typeof getCookie("utm_source") !== "undefined" ) {
						        var utm_source;
						        if(adsParseUrlParams( "utm_source" )){
						            utm_source = adsParseUrlParams( "utm_source" );
						            setCookie("utm_source", utm_source, {expires:1800, path: "/"});
						        } else {
						            utm_source = getCookie("utm_source");
						        }
						        utms.utm_source = utm_source;
						    }

						    if ( adsParseUrlParams( "utm_medium" ) || typeof getCookie("utm_medium") !== "undefined" ) {
						        var utm_medium;
						        if( adsParseUrlParams( "utm_medium" ) ){
						            utm_medium = adsParseUrlParams( "utm_medium" );
						            setCookie("utm_medium", utm_medium, {expires:1800, path: "/"});
						        } else {
						            utm_medium = getCookie("utm_medium");
						        }
						        utms.utm_medium = utm_medium;
						    }

						    if ( adsParseUrlParams( "utm_campaign" ) || typeof getCookie("utm_campaign") !== "undefined" ) {
						        var utm_campaign;
						        if(adsParseUrlParams( "utm_campaign" )){
						            utm_campaign = adsParseUrlParams( "utm_campaign" );
						            setCookie("utm_campaign", utm_campaign, {expires:1800, path: "/"});
						        } else {
						            utm_campaign = getCookie("utm_campaign");
						        }
						        utms.utm_campaign = utm_campaign ;
						    }

						    if ( typeof utms.utm_source !== "undefined" || typeof utms.utm_medium !== "undefined" || typeof utms.utm_campaign !== "undefined" ) {
						        var vastURL = new URL( window.jwVastTag[vHash] );
						        var vastParams = new URLSearchParams( vastURL.search );
						        var keys = Object.keys( utms );
						        if ( vastParams.has( "cust_params" ) ) {
						            var custParams = new URLSearchParams( vastParams.get( "cust_params" ) );
						        } else {
						            var custParams = new URLSearchParams();
						        }
					            for ( var key of keys ) {
					                custParams.set( key, utms[key]);
						        }
						        vastParams.set( "cust_params", decodeURIComponent( custParams.toString() ) );
						        vastURL.search = vastParams.toString();
						        url = vastURL.toString();
						    }

						    console.log( "AMI jwp GAM tag with UTM", url );

						    if ( localStorage._pdfps ) {
								var playerSegsPerm = encodeURIComponent("&permutive=" + encodeURIComponent(JSON.parse(localStorage._pdfps || "[]").slice(0,250).join(",")));
								url = url.replace(/(cust_params[^&]+)/, "$1" + playerSegsPerm);
						    }

						    console.log( "AMI jwp GAM tag with Permutive", url );

							


							return new Promise((resolve, reject) => {
							    let bidders = ["a9", "iris"];

				                // create a requestManager to keep track of bidder state to determine when to send ad server
				                // request and what amazonSlots to request from the ad server
				                var requestManager = {
				                    adserverRequestSent: false,
				                };

				                //loop through bidder array and add the bidders to the request manager:
				                bidders.forEach( function( bidder ) {
				                    requestManager[bidder] = false;
				                } );

				                // return true if all bidders have returned
				                function allBiddersBack() {
				                    var allBiddersBack = bidders
				                            // get the booleans from the object
				                            .map( function( bidder ) {
				                                return requestManager[bidder];
				                            } )
				                            // get rid of false values - indicates that the bidder has responded
				                            .filter( Boolean )
				                            // if length is equal to bidders, all bidders are back
				                            .length === bidders.length;

				                    return allBiddersBack;
				                }

				                // handler for header bidder responses
				                function headerBidderBack( bidder ) {
				                    // return early if request to adserver is already sent
				                    if ( requestManager.adserverRequestSent === true ) {
				                        return;
				                    }
				                    // flip bidder back flag
				                    if ( bidder === "a9" ) {
				                        requestManager.a9 = true;
				                        console.log("second promise a9 ready");
				                    } else if ( bidder === "iris" ) {
				                        requestManager.iris = true;
				                        console.log("second promise iris ready");
				                    }
				                    // if all bidders are back, send the request to the ad server
				                    if ( allBiddersBack() ) {
				                        resolve( url );
				                    }
				                }

								if ( typeof apstag == "object" && apstag ) {
					                apstag.fetchBids({
					                    slots: [{
					                        slotID: window.prerollTag[vHash],
					                        mediaType: "video"
					                    }]
					                }, function( bids ) {
					                    console.log( "AMI jwp amazon bid callback", new Date().getTime(), bids );
					                    window.jwpBids[vHash].amazon = true;
					                    if ( bids.length > 0 ) { //If we have received any bids back
					                        try {
					                            console.log("AMI jwp amazon bid request ad", bids[0].encodedQsParams);
					                            url = url + "&scp=" + bids[0].encodedQsParams;
					                        } catch ( e ) {
					                            console.log(e);
					                        }
					                    } else {
					                        console.log("AMI jwp amazon no bids");
					                    }
					                    headerBidderBack("a9");
					                });
				                } else {
				                    headerBidderBack("a9");
				                }

				                // Get main item context data
							    window.irisContext.getContext(jwplayer(el).getPlaylistItem().mediaid).then(function(data) {
									// Encode the context data
									console.log( "AMI jwp IrisTV Bids", new Date().getTime(), data.context );
									// Replace the server url with the context data (this is for simple ad requests),
									// If you have the serverUrl dynamically configured, then you will need to append the context data
									// under cust_params, so this is just for testing purpose

									if ( data.context && Object.keys( data.context ).length ) {
										var vastURL = new URL( url );
									    var vastParams = new URLSearchParams( vastURL.search );
									    if ( vastParams.has( "cust_params" ) ) {
									        var custParams = new URLSearchParams( vastParams.get( "cust_params" ) );
									    } else {
									        var custParams = new URLSearchParams();
									    }
						                custParams.set( "iris_context", data.context.join(","));
									    vastParams.set( "cust_params", decodeURIComponent( custParams.toString() ) );
									    vastURL.search = vastParams.toString();
									    url = vastURL.toString();
								    }
									headerBidderBack("iris");
							    });

								setTimeout(function(){
									resolve( url );
								}, 10000);
							});
						}
						console.log("AMI jwp before init el", el );
						console.log("AMI jwp before init jwp", jwplayer );
						var player_jwplayer_dxnnpOwg_Bk5vyVYE_div = jwplayer(el).setup(videoParams).on("ready", function(){
						var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
						var playerInstance = jwplayer(el);
						ns_.StreamingAnalytics.JWPlayer( playerInstance, {
							publisherId: "6036076",
							labelmapping: "ns_st_pu=\"AMI\", c3=\"Us Weekly\", ns_st_ge=\"" + decodeURIComponent( "%2Anull" ) + "\", ns_st_ia=\"" + decodeURIComponent( "%2Anull" ) + "\", ns_st_ce=\"" + decodeURIComponent( "1" ) + "\", ns_st_ddt=\"" + decodeURIComponent( "%2Anull" ) + "\", ns_st_tdt=\"" + decodeURIComponent( "%2Anull" ) + "\"",
						});
					}).on('adsManager', (e) => {
				var vHash = 'ami' + decodeURIComponent( 'dxnnpOwg' );
				const { adsManager, videoElement } = e;
				const iasConfig = {
				  anId: '928572',
				  campId: `${jwplayer().getWidth()}x${jwplayer().getHeight()}`, // This is dynamic based on player dimensions, but can be hard coded
				  chanId: window.prerollTag[vHash],
				  placementId: 'Open Auction',
				  pubOrder: 'Video',
				  pubId: 'Direct'
				};
				if (googleImaVansAdapter) {
				  googleImaVansAdapter.init(window.google, adsManager, videoElement, iasConfig);
				}
			}).on( 'time', function( e ) {
				var id = this.id;
				var pct = Math.round( e.position );

				if ( ! window.amiPlayersData ) {
					window.amiPlayersData = {};
				}


				if ( ! window.amiPlayersData[id] ) {
					window.amiPlayersData[id] = {
						m3: false,
						m10: false
					};
				}

				if ( window.amiPlayersData[id]['m3'] === false && pct >= 3 ) {
					window.amiPlayersData[id]['m3'] = true;
					console.log( '3sec played: ', id );
					window.dataLayer = window.dataLayer || [];
					dataLayer.push( {event: 'JWPlayEvent', jwTime: '3s played'} );
				}

				if ( window.amiPlayersData[id]['m10'] === false && pct >= 10 ) {
					window.amiPlayersData[id]['m10'] = true;
					console.log( '10sec played: ', id );
					window.dataLayer = window.dataLayer || [];
					dataLayer.push( {event: 'JWPlayEvent', jwTime: '10s played'} );
				}

			}).on( 'complete', function( e ) {
						if ( window.amiPlayersData && window.amiPlayersData[ this.id ] ) {
							window.amiPlayersData[ this.id ]['m3']  = false;
							window.amiPlayersData[ this.id ]['m10'] = false;
							console.log( 'clear played: ', this.id );
						}
					}).once("play", function(){
			var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
			var playerInstance = jwplayer(el);
			loadIrisPlugin(playerInstance, playerInstance.getConfig().plugins["https://ovp.iris.tv/plugins/jwplayer/v2/iris-jwplayer8.adaptive.min.js"])
			}).on('play', (e) => {
				var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
				var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );

				var jwInfo = jwplayer(el).getPlaylistItem(jwplayer(el).getPlaylistIndex());
				// skip if the video was paused and trying to resume
				if (jwplayer(el).getState() !== 'idle' && jwplayer(el).getState() !== 'complete') {
				    return;
				}

				window.permutive.track("VideoPlay", {
					play_id: el, //this will stay constant for all of the events emitted during the same video play
					video: {
						duration: Math.round(jwInfo.duration), // in seconds
						name: jwInfo.title,
						video_id: decodeURIComponent( "dxnnpOwg" ),
						description: jwInfo.description,
						published_at: new Date(jwInfo.pubdate).toISOString()
					},
					enriched_data:{
						tvchannel: decodeURIComponent( "Us%20Weekly" ), //tv channel name
					    language:"English", //language of the content
					    type: "video",
					    keywords: jwInfo.tags.split(","), //keywords for the page
					}
				});

				console.log("Permutive video play");

			}).on('complete', (e) => {
				var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
				var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );

				var jwInfo = jwplayer(el).getPlaylistItem(jwplayer(el).getPlaylistIndex());
				// skip if the video was paused and trying to resume
				if (jwplayer(el).getState() !== 'idle' && jwplayer(el).getState() !== 'complete') {
				    return;
				}

				window.permutive.track("VideoComplete", {
					play_id: el, //this will stay constant for all of the events emitted during the same video play
					video: {
						duration: Math.round(jwInfo.duration), // in seconds
						name: jwInfo.title,
						video_id: decodeURIComponent( "dxnnpOwg" ),
						description: jwInfo.description,
						published_at: new Date(jwInfo.pubdate).toISOString()
					},
					enriched_data:{
						tvchannel: decodeURIComponent( "Us%20Weekly" ), //tv channel name
					    language: "English", //language of the content
					    type: "video",
					    keywords: jwInfo.tags.split(","), //keywords for the page
					}
				});
				console.log("Permutive video event:", e);
				window.lock_25 = false;
				window.lock_50 = false;
				window.lock_75 = false;
				window.lock_100 = false;
			}).on('time', (e) => {
				var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
				var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );
				var jwInfo = jwplayer(el).getPlaylistItem(jwplayer(el).getPlaylistIndex());
				var progress = (e.currentTime/e.duration).toFixed(2);

				if (
					(0.25 === progress && false === window.lock_25) ||
					(0.5 === progress && false === window.lock_50) ||
					(0.75 === progress && false === window.lock_75) ||
					(100 === progress && false === window.lock_100)
				) {
					window.permutive.track("VideoProgress", {
						play_id: el, //this will stay constant for all of the events emitted during the same video play
						progress: Number(progress),
						video: {
							duration: Math.round(jwInfo.duration), // in seconds
							name: jwInfo.title,
							video_id: decodeURIComponent( "dxnnpOwg" ),
							description: jwInfo.description,
							published_at: new Date(jwInfo.pubdate).toISOString()
						},
						enriched_data:{
							tvchannel: decodeURIComponent( "Us%20Weekly" ), //tv channel name
						    language: "English", //language of the content
						    type: "video",
						    keywords: jwInfo.tags.split(","), //keywords for the page
						}
					});
					if ( 0.25 === progress ) {
						window.lock_25 = true;
					}
					if ( 0.5 === progress ) {
						window.lock_50 = true;
					}
					if ( 0.75 === progress ) {
						window.lock_75 = true;
					}
					if ( 1 === progress ) {
						window.lock_100 = true;
					}
					console.log("Permutive video play progress " + progress);
				}

			}).on('mute', (e) => {
				var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
				var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );

				var jwInfo = jwplayer(el).getPlaylistItem(jwplayer(el).getPlaylistIndex());

				window.permutive.track("VideoEvent", {
					play_id: el, //this will stay constant for all of the events emitted during the same video play
					event: (e.mute) ? "sound off" : "sound on",
					video: {
						duration: Math.round(jwInfo.duration), // in seconds
						name: jwInfo.title,
						video_id: decodeURIComponent( "dxnnpOwg" ),
						description: jwInfo.description,
						published_at: new Date(jwInfo.pubdate).toISOString()
					}
				});

				console.log("Permutive video event:", e);


			}).on('fullscreen', (e) => {
				var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
				var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );

				var jwInfo = jwplayer(el).getPlaylistItem(jwplayer(el).getPlaylistIndex());

				window.permutive.track("VideoEvent", {
					play_id: el, //this will stay constant for all of the events emitted during the same video play
					event: (e.fullscreen) ? "fullscreen on" : "fullscreen off",
					video: {
						duration: Math.round(jwInfo.duration), // in seconds
						name: jwInfo.title,
						video_id: decodeURIComponent( "dxnnpOwg" ),
						description: jwInfo.description,
						published_at: new Date(jwInfo.pubdate).toISOString()
					}
				});
				console.log("Permutive video event:", e);
			}).on('ready', (e) => {
				var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
				var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );

				var jwInfo = jwplayer(el).getPlaylistItem(jwplayer(el).getPlaylistIndex());
				console.log(jwInfo);
				window.lock_25 = false;
				window.lock_50 = false;
				window.lock_75 = false;
				window.lock_100 = false;

				window.permutive.track("VideoLoad", {
					play_id: el, //this will stay constant for all of the events emitted during the same video play
					video: {
						duration: Math.round(jwInfo.duration), // in seconds
						name: jwInfo.title,
						video_id: decodeURIComponent( "dxnnpOwg" ),
						description: jwInfo.description,
						published_at: new Date(jwInfo.pubdate).toISOString()
					},
					enriched_data:{
						tvchannel: decodeURIComponent( "Us%20Weekly" ), //tv channel name
					    language: "English", //language of the content
					    type: "video",
					    keywords: jwInfo.tags.split(","), //keywords for the page
					}
				});
				console.log("Permutive video load event");
			}).on('adPlay', (e) => {
				var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
				var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );

				window.adInfo = e;
				var jwInfo = jwplayer(el).getPlaylistItem(jwplayer(el).getPlaylistIndex());


				window.adlock_25 = false;
				window.adlock_50 = false;
				window.adlock_75 = false;
				window.adlock_100 = false;

				window.permutive.track("VideoAdPlay", {
					play_id: el, //this will stay constant for all of the events emitted during the same video play
					ad: {
						duration: Math.round(window.adInfo.duration),
						creative_name: window.adInfo.adtitle,
						ad_id: window.adInfo.adId,
						title: window.adInfo.adtitle,
						video_type: "instream" //outstream
					},
					video: {
						duration: Math.round(jwInfo.duration), // in seconds
						name: jwInfo.title,
						video_id: decodeURIComponent( "dxnnpOwg" ),
						description: jwInfo.description,
						published_at: new Date(jwInfo.pubdate).toISOString()
					},
					enriched_data:{
						tvchannel: decodeURIComponent( "Us%20Weekly" ), //tv channel name
					    language: "English", //language of the content
					    type: "video",
					    keywords: jwInfo.tags.split(","), //keywords for the page
					}
				});
				console.log("Permutive video ad play");
			}).on('adClick', (e) => {
				var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
				var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );

				var jwInfo = jwplayer(el).getPlaylistItem(jwplayer(el).getPlaylistIndex());

				window.permutive.track("VideoAdClick", {
					play_id: el, //this will stay constant for all of the events emitted during the same video play
					ad: {
						duration: Math.round(window.adInfo.duration),
						creative_name: window.adInfo.adtitle,
						ad_id: window.adInfo.adId,
						title: window.adInfo.adtitle,
						video_type: "instream" //outstream
					},
					video: {
						duration: Math.round(jwInfo.duration), // in seconds
						name: jwInfo.title,
						video_id: decodeURIComponent( "dxnnpOwg" ),
						description: jwInfo.description,
						published_at: new Date(jwInfo.pubdate).toISOString()
					},
					enriched_data:{
						tvchannel: decodeURIComponent( "Us%20Weekly" ), //tv channel name
					    language: "English", //language of the content
					    type: "video",
					    keywords: jwInfo.tags.split(","), //keywords for the page
					}
				});
				console.log("Permutive video ad click");
			}).on('adTime', (e) => {
				var el = decodeURIComponent( "jwplayer_dxnnpOwg_Bk5vyVYE_div" );
				var vHash = "ami" + decodeURIComponent( "dxnnpOwg" );
				var jwInfo = jwplayer(el).getPlaylistItem(jwplayer(el).getPlaylistIndex());
				var progress = (e.position/e.duration).toFixed(2);

				if (
					(0.25 >= progress && false === window.adlock_25) ||
					(0.5 >= progress && false === window.adlock_50) ||
					(0.75 >= progress && false === window.adlock_75) ||
					(0.95 >= progress && false === window.adlock_100)
				) {

					window.permutive.track("VideoAdProgress", {
						play_id: el, //this will stay constant for all of the events emitted during the same video play
						progress: Number(progress),
						ad: {
							duration: Math.round(window.adInfo.duration),
							creative_name: window.adInfo.adtitle,
							ad_id: window.adInfo.adId,
							title: window.adInfo.adtitle,
							video_type: "instream" //outstream
						},
						video: {
							duration: Math.round(jwInfo.duration), // in seconds
							name: jwInfo.title,
							video_id: decodeURIComponent( "dxnnpOwg" ),
							description: jwInfo.description,
							published_at: new Date(jwInfo.pubdate).toISOString()
						},
						enriched_data:{
							tvchannel: decodeURIComponent( "Us%20Weekly" ), //tv channel name
						    language: "English", //language of the content
					        type: "video",
						    keywords: jwInfo.tags.split(","), //keywords for the page
						}
					});
					if ( 0.25 >= progress ) {
						window.adlock_25 = true;
					}
					if ( 0.5 >= progress ) {
						window.adlock_50 = true;
					}
					if ( 0.75 >= progress ) {
						window.adlock_75 = true;
					}
					if ( 0.95 >= progress ) {
						window.adlock_100 = true;
					}
					console.log("Permutive video ad progress " + progress);
				}
			}).setPlaylistItemCallback(function(item, index) {
			return waitForAmazon // Wait until Amazon is loaded.
		        .then(() => performAsyncBidding( player_jwplayer_dxnnpOwg_Bk5vyVYE_div, item, index ), () => { console.log("AMI JWP bidding FAILER"); }) // External bidding.
		        .then(tag => {
		            // Update the playlist item.
		            console.log("AMI jwp new headerbid", tag);

		            return Object.assign({}, item, {
		                adschedule: [{
		                    tag,
		                    offset: "pre"
		                }]
		            });
		        }).catch(function(e){
		            console.log("AMI jwp bidding failed", e);
		            return item;
		        }); // If bidding fails, use unmodified playlist item.
		});
					}
				}, 500);
			})();