Author Topic: MOD: Embedded Videos Counting  (Read 5687 times)

theebanr

  • Newbie
  • *
  • Posts: 77
    • Vakthaa.tv
Re: MOD: Embedded Videos Counting
« Reply #15 on: September 16, 2008, 01:15:07 AM »
Hi lennonNZ

when are you going to release this mod???

X-Rayden

  • Guest
Re: MOD: Embedded Videos Counting
« Reply #16 on: September 18, 2008, 11:35:35 PM »
i've done a mod that with simple tweak embeded video counts? i'll do another topic to explain it...

LennonNZ

  • Hero Member
  • *****
  • Posts: 972
    • Bcast New Zealand
Re: MOD: Embedded Videos Counting
« Reply #17 on: September 19, 2008, 04:20:38 AM »
ok.. here is the code. Works with V3.X of jw player (as V4 changed things and its has to be done with javascript) which will be later. It will actually count the number of views of the videos (when someone actually presses play)

You can use this by using the callback option of jw player V3.X and add it in the code for when people embed it into their webpage.

Add at the end of the embedded code   &callback="www.example.com/recordactivity.php"

recordactivity.php
Quote
<?php
include_once ("classes/config.php");
include_once ("classes/settings.php");

        extract($_POST, EXTR_PREFIX_SAME, "post_");
        if ($state == "start")
                {
                preg_match("/(.*)\/uploads\/(.*).flv(.*)/", $file, $matches);
                $video_id = mysql_real_escape_string($matches[2]);
                $query = "SELECT * FROM videos WHERE video_id = '$video_id' AND approved = 'yes'";
                $result = mysql_query($query) or die();
                while ($row = mysql_fetch_assoc($result)){
                        $indexer = $row['indexer'];
                        $number_of_views = $row['number_of_views'];
                        }
                $number_of_views = $number_of_views + 1;
                $query = "UPDATE videos set number_of_views = $number_of_views WHERE indexer = $indexer";
                $result = mysql_query($query);
                }
 
?>


X-Rayden

  • Guest
Re: MOD: Embedded Videos Counting
« Reply #18 on: September 25, 2008, 02:36:35 PM »

bootmaker

  • Guest
Re: MOD: Embedded Videos Counting
« Reply #19 on: November 09, 2008, 07:58:52 PM »
v4 plugin : http://www.jeroenwijering.com/?thread=12535

it would be nice to see your code in this forum. With details on what file/s to edit

bootmaker

  • Guest
Re: MOD: Embedded Videos Counting
« Reply #20 on: November 06, 2010, 06:54:53 PM »
ok.. here is the code. Works with V3.X of jw player (as V4 changed things and its has to be done with javascript) which will be later. It will actually count the number of views of the videos (when someone actually presses play)

You can use this by using the callback option of jw player V3.X and add it in the code for when people embed it into their webpage.

Add at the end of the embedded code   &callback="www.example.com/recordactivity.php"

recordactivity.php
Quote
<?php
include_once ("classes/config.php");
include_once ("classes/settings.php");

        extract($_POST, EXTR_PREFIX_SAME, "post_");
        if ($state == "start")
                {
                preg_match("/(.*)\/uploads\/(.*).flv(.*)/", $file, $matches);
                $video_id = mysql_real_escape_string($matches[2]);
                $query = "SELECT * FROM videos WHERE video_id = '$video_id' AND approved = 'yes'";
                $result = mysql_query($query) or die();
                while ($row = mysql_fetch_assoc($result)){
                        $indexer = $row['indexer'];
                        $number_of_views = $row['number_of_views'];
                        }
                $number_of_views = $number_of_views + 1;
                $query = "UPDATE videos set number_of_views = $number_of_views WHERE indexer = $indexer";
                $result = mysql_query($query);
                }
 
?>



I have not tested this. Is this working now?