View Full Version : Function detection

07-11-2011, 08:36 PM
I use the youtube javascript api. Now the users of my website can start the player with an imacro and the function player.playVideo(). Is it possible that I can detect or disable this funtion?


rnd me
07-11-2011, 09:00 PM

07-11-2011, 09:41 PM
Thanks for the reply, but do you know where to put this? If I put it directly in the player it doesn't load the player...

rnd me
07-11-2011, 11:40 PM
ok, well that still stops "them" right? haha

i guess you want to be able to use it, but not allow others to.

try adding a required argument to playVideo, something to make it slightly more difficult to abscound:

var oldPlay=player.playVideo;
if(password=="something"){ oldPlay.call(player); }

then change your buttons from "player.playVideo()" to "player.playVideo('something')"...

you can change the argument and the password at the same time using a server-side script if you want to prevent them from hard-coding the 'password'...

07-12-2011, 12:49 AM
No I don't need it, the player code is:

function loadPlayer() {

var videoID = ""

var params = { allowScriptAccess: "always" };

var atts = { id: "ytPlayer" };

swfobject.embedSWF("http://www.youtube.com/v/" + videoID +
"videoDiv", "640", "385", "8", null, null, params, atts);


Now there are two ways to start the player, you can click the start button or you can call player.playVideo() through javascript. I try now to disable this call or to detect it, because youtube doesn't count these views...Thanks for the help

rnd me
07-12-2011, 06:43 PM
you're not supposed to ask for help with cheating on other sites' rules...

if you want your clicks counted without cheating, simply embed an auto-play iframe on-demand instead of using their crappy js embeds. a modal is a great place for such an iframe...

07-12-2011, 08:27 PM
I don't want to cheat other sites, the users are cheating my site with imacros. And I try to prevent them from cheating. The problem is the whole thing is working with js. But thanks for the help, I think it's not even possible what I'm asking for...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum