Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-11-2011, 08:36 PM   PM User | #1
selenin
New Coder

 
Join Date: Jun 2010
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
selenin is an unknown quantity at this point
Function detection

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
selenin is offline   Reply With Quote
Old 07-11-2011, 09:00 PM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Code:
player.playVideo=null
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 07-11-2011, 09:41 PM   PM User | #3
selenin
New Coder

 
Join Date: Jun 2010
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
selenin is an unknown quantity at this point
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...
selenin is offline   Reply With Quote
Old 07-11-2011, 11:40 PM   PM User | #4
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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:


Code:
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'...
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 07-12-2011, 12:49 AM   PM User | #5
selenin
New Coder

 
Join Date: Jun 2010
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
selenin is an unknown quantity at this point
No I don't need it, the player code is:

Code:
    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
selenin is offline   Reply With Quote
Old 07-12-2011, 06:43 PM   PM User | #6
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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...
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 07-12-2011, 08:27 PM   PM User | #7
selenin
New Coder

 
Join Date: Jun 2010
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
selenin is an unknown quantity at this point
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...
selenin is offline   Reply With Quote
Reply

Bookmarks

Tags
youtube api

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:31 PM.


Advertisement
Log in to turn off these ads.