// 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); }; });

Xbox One and PC, it’s almost time to get in on the Modern Warfare Early Access Beta!

Players who have pre-ordered Call of Duty: Modern Warfare on Xbox One and PC can now start to pre-load the Beta ahead of its official start time of 10AM PT on Thursday, September 19.

For PlayStation 4 players, the Open Beta will be live for all PS4 players starting 10AM PT on Sept. 19 and end on Sept. 23 at 10AM PT. Players on PS4 who missed weekend 1 can now pre-load the Open Beta ahead of its start.

Xbox One and PC players, here’s the details on how to pre-load:

Retail Pre-Order Players

Accessing Your Beta Code: Check the email of the address that’s attached to your Call of Duty account.If you don’t see this email in your inbox, check your SPAM/Junk folder.If you find the Beta Codes email in either of these folders, make sure you mark these emails as “Not Spam” so you can continue to receive important messages from Call of Duty. Head to the callofduty.com/redeem and login with your COD account.If you don’t find the email in either place, or your beta code on the redemption site reach out to Player Support.

Downloading the Beta (Xbox One): Once you’ve received your Beta Code, go to the Microsoft Store.Select ‘Use a Code’.Enter your Beta Code and the download will begin!

Downloading the Beta (PC Dark Edition: Battle.net)

Once you’ve received your Beta Code, log in to Battle.net. Visit ‘Account Settings’. Select the ‘Games & Codes’ tab then ‘Code Redemption’. Enter your Beta Code and the download will begin!

Digital Pre-Order Players

Beta Code is Not Needed: If you pre-ordered Modern Warfare digitally, you are automatically ready to download the Beta. Look for instructions regarding preloading availability, and then visit your platform’s store:

Downloading the Beta (Xbox One): Go to the Microsoft Store, look for Modern Warfare, following the prompts to download the Beta, and you’re set!

Downloading the Beta (PC: Battle.net)

Log in to Battle.net. Head to the Modern Warfare page and install the Beta.    

Stay tuned for the latest news on the Modern Warfare Beta!

comments below