Player Event Tracking*

The following code illustrates what a play event listener would look like in the presence of a player iframe originating from a different domain. 

<p>
<script type="text/javascript">// <![CDATA[
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event)
{
    try
    {
        switch(event.data.player.type){
            case 'playPercent': 
                if(event.data.player.value === 0){
                    console.log("Play started!");
                }
                break;
            case 'ended':
                console.log("Play ended!");
                break;
        }
    }
    catch(err){
        console.log("Non player event");
    }
}
// ]]></script>
</p>
<p><iframe width="640" height="360" title="Vidcaster TV Video Player" src="http://tv.vidpage.tv/player/rtG/autoplay" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe></p>