"use strict";var gtm4wp_html5media_percentage_tracking=10,gtm4wp_html5media_percentage_tracking_marks={};jQuery(function(){jQuery('video:not([src*="vimeo.com|youtube.com|soundcloud.com"]),video:has(source),audio[src],audio:has(source)').each(function(){var e=this.currentSrc.split("/").pop();window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerReady",mediaType:"html5media",mediaData:{id:e,author:"",title:e,url:this.currentSrc,duration:0},mediaCurrentTime:0}),jQuery(this).on("play pause seeked ended",function(e){var t=this.currentSrc.split("/").pop();window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerStateChange",mediaType:"html5media",mediaData:{id:t,author:"",title:t,url:this.currentSrc,duration:isNaN(this.duration)?0:this.duration},mediaPlayerState:e.type,mediaCurrentTime:isNaN(this.currentTime)?0:this.currentTime})}),jQuery(this).on("error",function(e){var t=this.currentSrc.split("/").pop();window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"html5video",mediaData:{id:t,author:"",title:t,url:this.currentSrc,duration:isNaN(this.duration)?0:this.duration},mediaCurrentTime:isNaN(this.currentTime)?0:this.currentTime,mediaPlayerEvent:"error",mediaPlayerEventParam:this.error.code})}),jQuery(this).on("ratechange",function(e){var t=this.currentSrc.split("/").pop();window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"html5video",mediaData:{id:t,author:"",title:t,url:this.currentSrc,duration:isNaN(this.duration)?0:this.duration},mediaCurrentTime:isNaN(this.currentTime)?0:this.currentTime,mediaPlayerEvent:"ratechange",mediaPlayerEventParam:this.playbackRate})}),jQuery(this).on("volumechange",function(e){var t=this.currentSrc.split("/").pop();window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"html5video",mediaData:{id:t,author:"",title:t,url:this.currentSrc,duration:isNaN(this.duration)?0:this.duration},mediaCurrentTime:isNaN(this.currentTime)?0:this.currentTime,mediaPlayerEvent:"volumechange",mediaPlayerEventParam:this.volume})}),jQuery(this).on("timeupdate",function(e){if(!isNaN(this.duration)&&!isNaN(this.currentTime)){var t=this.duration,a=this.currentTime,i=Math.floor(a/t*100),r=this.currentSrc.split("/").pop(),n=r;void 0===gtm4wp_html5media_percentage_tracking_marks[n]&&(gtm4wp_html5media_percentage_tracking_marks[n]=[]);for(var m=0;m<100;m+=gtm4wp_html5media_percentage_tracking)m<i&&-1==gtm4wp_html5media_percentage_tracking_marks[n].indexOf(m)&&(gtm4wp_html5media_percentage_tracking_marks[n].push(m),window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlaybackPercentage",mediaType:"html5media",mediaData:{id:r,author:"",title:r,url:this.currentSrc,duration:t},mediaCurrentTime:a,mediaPercentage:m}))}})})});