Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    Code:
    player.playVideo=null
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #3
    New Coder
    Join Date
    Jun 2010
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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...

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #5
    New Coder
    Join Date
    Jun 2010
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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

  • #6
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #7
    New Coder
    Join Date
    Jun 2010
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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...


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •