var player = new Array(); http://var/ counter = 0; function playerReady(obj) { var id = obj['id']; var version = obj['version']; var client = obj['client']; //console.log('the videoplayer '+id+' has been instantiated'); player[id] = document.getElementById(id); addListeners(id); }; function addListeners(id) { if (player[id]) { player[id].addModelListener("STATE", "stateListener"); } else { setTimeout("addListeners()",100); } } function stateListener(obj) { http://possible/ states IDLE, BUFFERING, PLAYING, PAUSED, COMPLETED currentState = obj.newstate; previousState = obj.oldstate; //console.log('current state : '+ currentState + ' previous state : '+ previousState ); http://find/ out what title is playing (or id of the file) var cfg = player[obj.id].getConfig(); var plst = player[obj.id].getPlaylist(); http://decide/ if the counter needs updating and then http://update/ in the db with ajax request var decision = false; if (((currentState == "PLAYING") && ( (previousState == "BUFFERING") ||(previousState == "COMPLETED")))) { decision = true; } if(decision) { var ajaxString = "file=" + escape( plst[cfg["item"]].file ); jQuery.ajax({ type: "POST", data: ajaxString, url: "index.php?wt-stat=true" }); } } /* FILE ARCHIVED ON 01:13:02 Aug 04, 2015 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 09:42:44 Aug 18, 2017. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */