...

View Full Version : Function detection



selenin
07-11-2011, 09: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?

Thanks

rnd me
07-11-2011, 10:00 PM
player.playVideo=null

selenin
07-11-2011, 10: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-12-2011, 12:40 AM
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;
player.playVideo=function(password){
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'...

selenin
07-12-2011, 01: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 +
"&enablejsapi=1&playerapiid=player1",
"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, 07: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...

selenin
07-12-2011, 09: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