Thank you for purchasing videochat PHP script based on OpenTok API. If you have any questions that are beyond the scope of this help file, please feel free to email roman.codecanyon@gmail.com. Thanks so much!
~/root/protected/config/opentok.php
return array( "API_KEY"=>"", // Replace this value with your OpenTok API Partner Key "API_SECRET"=>"", // Replace this value with your OpenTok API Partner Secret );
All application settings located in
~/root/protected/config/main.php
Let's begin with connection to the database. Open config file and modify following lines with your mysql credentials.
'db'=>array( // Mysql with host: localhost and databse name: videochat 'connectionString' => 'mysql:host=localhost;dbname=videochat', // whether to turn on prepare emulation 'emulatePrepare' => true, // db username 'username' => 'root', // db password 'password' => '', // default cahrset 'charset' => 'utf8', // table prefix 'tablePrefix' => 'ca_', // cache time to reduce SHOW CREATE TABLE * queries 'schemaCachingDuration' => 60 * 60 * 24 * 30, ),
* * * * * | Time and date for your task. In our case cron will be executed every 1 minute |
/usr/bin/php | path to php command |
/path/to/web/root/protected/clearsession.php | physical path to script |
>/dev/null 2>&1 | this mean that all output from this command should be shoved into a black hole. I.e just do nothing with output. |
'clearKey' => false,
'clearKey' => 'abc',
http://your.domain/?r=clear/index&key=abc
http://your.domain/subdir/?r=clear/index&key=abc
Remains only register this URL in your 3rd party service.
'sessIntTime' => 50 * 1000, // Milliseconds 50 * 1000 ms == 50 sec 'dataSync' => 5 * 1000, // Milliseconds. Informer and online users 'chatActivity' => array( // NoActivity => Time between requests 0 => 1 * 1000, 3 => 2 * 1000, 10 => 5 * 1000, 20 => 15 * 1000, 30 => 30 * 1000, ),
sessInTime |
Time in milliseconds. When user talking face-to-face he is not active and session on the server can expire.
To prevent this, we send request each 50 seconds, to handle user online.
|
dataSync | Time in milliseconds. After each 5 seconds script updates user list and notifications which has been sent to user. |
chatActivity |
This array controls chat activity. The algorithm is very straightforward.
When user do not recieves new messages after 3 requests. (in our case first 3 requests repeates every 1000 milliseconds)
The next 7 requests will be repeated every 2 seconds and etc.
Therefore we can save resources and traffic. If user just talking and not sending messages the chat will be in passive mode.
|
~/root/protected/messages/en/app.php
"Username" => "My custom username",
'default_timezone' => 'Europe/Vilnius',
Q: How to change app name?
A: You can change app name in config file
'name'=>'Free VideoChat',
Q: Something does not work? What to do?
A: All errors are logged in
~/root/protected/runtime/application.log
This app is built using OpenTok platform. Today (2013-09-01) they provide unlimited number of minutes for "face-to-face" video chat . I am not responsible if in the future they will close this service or make its paid.