// initialize jwplayer var playerInstance = jwplayer('player');// player dom elements var playerContainerEl = document.querySelector('.player-container');// returns video player position from top of document function getElementOffsetTop(el) { var boundingClientRect = el.getBoundingClientRect(); var bodyEl = document.body; var docEl = document.documentElement; var scrollTop = window.pageYOffset || docEl.scrollTop || bodyEl.scrollTop; var clientTop = docEl.clientTop || bodyEl.clientTop || 0; return Math.round(boundingClientRect.top + scrollTop - clientTop); }// returns the current y scroll position function getScrollTop() { var docEl = document.documentElement; return (window.pageYOffset || docEl.scrollTop) - (docEl.clientTop || 0); }// configure jwplayer instance playerInstance.setup({ autostart: true, playlist: 'https://cdn.jwplayer.com/v2/playlists/mYdavspX', primary: 'html5', setFullscreen: true, width: '100%' });// when jwplayer instance is ready playerInstance.on('ready', function() { var config = playerInstance.getConfig(); var utils = playerInstance.utils; // get height of player element var playerHeight = config.containerHeight; // flag determining whether close has been clicked var closed = true; // CHANGED // flag determing whether player is playing var playing = false; // ADDED // eventhandler for when close button is being pressed document.getElementsByClassName('icon-close')[0].addEventListener('click', () => { closed = true; onScrollViewHandler(); }); playerInstance.on('play', function() { closed = false; playing = true; // ADDED }).on('pause', function () { playing = false; // ADDED }).on('adPlay', function() { closed = false; // ADDED playing = true; // ADDED }).on('adPause', function() { playing = false; // ADDED });// get player element position from top of document var playerOffsetTop = getElementOffsetTop(playerContainerEl);// set player container to match height of actual video element playerContainerEl.style.height = playerHeight + 'px';// below we handle window scroll event without killing performance function onScrollViewHandler() { var minimized = getScrollTop() >= playerOffsetTop;if (closed && minimized) { minimized = false; jwplayer().pause(); playing = false; // ADDED } else if (!minimized && !playing) { closed = true; // ADDED } utils.toggleClass(playerContainerEl, 'player-minimize', minimized); // update the player's size so the controls are adjusted playerInstance.resize(); }// namespace for whether or not we are waiting for setTimeout() to finish var isScrollTimeout = false;// window onscroll event handler window.onscroll = function() { // skip if we're waiting on a scroll update timeout to finish if (isScrollTimeout) return; // flag that a new timeout will begin isScrollTimeout = true; // otherwise, call scroll event view handler onScrollViewHandler(); // set new timeout setTimeout(function() { // reset timeout flag to false (no longer waiting) isScrollTimeout = false; }, 80); };});

With Call of Duty: Infinite Warfare out now, here’s a round-up of some of the reviews from press sites:

  • Polygon – 8.5/10 – “There’s no doubt that Infinity Ward made a wise call in ditching the Ghosts franchise. Call of Duty: Infinite Warfare is one of the best campaigns the series has provided, with stellar writing and varied environments. While that level of ingenuity didn’t transfer over to multiplayer and Zombies, taken as an entire package, Infinite Warfare is a standout effort whose biggest sin is not trying to reinvent the wheel at every turn.”
  • GameInformer 9/10 – “Infinite Warfare provides a potent triple-threat of entertainment: A hard-hitting campaign that deals with the sacrifices of war, a multiplayer mode overflowing with customization, and a nostalgia-laden trip through the ‘80s with the Zombies mode.” 
  • Destructoid – 7/10 – “Call of Duty: Infinite Warfare does just enough to stay above the curve and somewhat make up for the appropriately soulless Ghosts. The zombies team did an incredible job with Spaceland, and the multiplayer still ticks all of the right boxes with an ample locomotion system that has since been surpassed by Titanfall. But if you were expecting anything totally new, including the non-inventive space campaign, look elsewhere. Or, look directly to the inside of your slipcase and enter the code for Modern Warfare Remastered.”
  • GameSpot – 8/10 – “By venturing beyond Earth–and not just to other planets, but to space itself–Call of Duty found a canvas to produce its best story in years. It reinforces the notion that a game’s narrative is only as good as its characters. Given the campaign’s accomplishments in space combat, it’s puzzling that no effort was made to replicate its zero-G sensations in Infinite Warfare’s multiplayer. Consequently, the well-crafted Zombies mode is a more attractive, time-consuming proposition for those looking to play with friends.” 
  • EGM Now – 7/10 – “Infinite Warfare is one step forward; two steps back for Call of Duty. The multiplayer is still fun, but suspect microtransactions have left me wary. The campaign also gets more wrong than right with shoddy storytelling overshadowing the usually tight FPS gameplay. At the very least, we got a Zombies experience comparable to what we’ve seen in the past—and Modern Warfare Remastered was a fun stroll down memory lane.”
  • TIME – 2.5/5 – “An assemblage of hits and misses, that’s the measure of this year’s Call of Duty. I could say something about publisher Ubisoft pulling back from its annualized Assassin’s Creed franchise, or how even Doctor Who gets a break. But it’s probably simplest to remind that it’s shooter season, and this year, the alternatives are formidable.”
  • GamesRadar – “It’s a solidly entertaining COD this year then: consistent and exciting, albeit perhaps without any overtly outstanding moments. It’s one of the prettiest games in the series for a while, but looking back I struggle to remember any truly killer bits I want to tell my friends about. It’s more one big overall pleasing shooty space noise – satisfying throughout, with no massive peaks but, more importantly, no troughs either.”
  • Attack of the Fanboy“Call of Duty: Infinite Warfare is chock full of content. The campaign, multiplayer, and zombies modes all add up to a game that will keep you playing for hours. These individual modes might have their faults, with the campaign being particularly skippable if you just want that base action gameplay. The multiplayer remains true to its roots, even with the big shift in setting. And Zombies is the highlight of the experience in a lot of ways, offering a great co-op experience. All together, Call of Duty: Infinite Warfare is a winner. It just might not be the biggest winner the series has had.”
  • EuroGamer Italy – 7/10
comments below