Pause a Video When the CTA Button is Clicked
When a viewer clicks on your CTA button, you can choose to redirect them to another page which opens on a new tab in their browser. And when that happens, you may also want to consider pausing the video while they're on the new tab. To make that happen, you just need to add this script to your page:
<div id="vidalytics_embed_5LI9f8OC1bFDzl9W" style="width: 100%; position:relative; padding-top: 56.25%;"></div>
<script type="text/javascript">
(function (v, i, d, a, l, y, t, c, s) {
y='_'+d.toLowerCase();c=d+'L';if(!v[d]){v[d]={};}if(!v[c]){v[c]={};}if(!v[y]){v[y]={};}var vl='Loader',vli=v[y][vl],vsl=v[c][vl + 'Script'],vlf=v[c][vl + 'Loaded'],ve='Embed';
if (!vsl){vsl=function(u,cb){
if(t){cb();return;}s=i.createElement("script");s.type="text/javascript";s.async=1;s.src=u;
if(s.readyState){s.onreadystatechange=function(){if(s.readyState==="loaded"||s.readyState=="complete"){s.onreadystatechange=null;vlf=1;cb();}};}else{s.onload=function(){vlf=1;cb();};}
i.getElementsByTagName("head")[0].appendChild(s);
};}
vsl(l+'loader.min.js',function(){if(!vli){var vlc=v[c][vl];vli=new vlc();}vli.loadScript(l+'player.min.js',function(){var vec=v[d][ve];t=new vec();t.run(a);});});
})(window, document, 'Vidalytics', 'vidalytics_embed_5LI9f8OC1bFDzl9W', 'https://quick.vidalytics.com/embeds/sXFEYTDU/5LI9f8OC1bFDzl9W/');
</script>
<script>
// update this to match your Vidalytics Embed ID
const EMBED_ID = 'vidalytics_embed_5LI9f8OC1bFDzl9W';
!function(v,a,p,i){
v.getVidalyticsPlayer=n=>{v[a]=v[a]||{},v[a][p]=v[a][p]||{};let d=v[a][p][n]=v[a][p][n]||{};
return new Promise((e=>{if(d[i])return void e(d[i]);let t;
Object.defineProperty(d,i,{get:()=>t,set(i){t=i,e(i)}})}))}
}(window,'_vidalytics','embeds','player');
getVidalyticsPlayer(EMBED_ID).then(player => {
player.on('cta:click', () => {
player.pause();
window.addEventListener('focus', () => {
player.play();
}, false);
});
});
</script>