05 September, 2010

Integrating Videowhisper in CodeIgniter

Some times ago, i confronted a problem of integrating videowhisper with CodeIgniter. Searched through videowhisper forums but could not get exact solution, though i managed to do it using info regarding integration for plain php code.
I hope this might help someone like me.
Lets say we have a project folder named "test"
Step 1:
Add the "videowhisper_conference.swf" file in you root folder (project folder test) and its necessary folders like "uploads", "emoticons", etc. in the same folder

Step 2:
Copy the contents of "videowhisper_conference.php" into your view file, where you want to display the video.

Step 3:
Create function in your controller for each of the file, such as videologin for vc_login.php, videostatus for vc_status.php file. Do this for all the .php files that you require.

Step 4:
Add following code in you .htaccess file
RewriteCond %{QUERY_STRING} room_name(.*)

RewriteRule vc_login.php(.*) folder_name/controller_name/videologin/%1? [L]
RewriteRule vw_rooms.php(.*) folder_name/controller_name/videorooms/%1? [L]
RewriteRule vw_files.php(.*) folder_name/controller_name/videofiles/%1? [L]
RewriteRule vc_status.php(.*) folder_name/controller_name/videostatus/%1? [L]
and so on for all the files that you need.

You are done.
I've mentioned general steps in this case. You need to pass on the logged in user id and other required values accordingly.
Hope it helps.

5 comments:

Anonymous said...

thanks for your postings.
I will try it.

Anonymous said...

I was failed to try it. could you please let me know what should be in the function such as videologin?

is this right?
function videologin()
{
//$this->load->view('header');
$this->load->view('videochat/2wvc_php/2_login');
}

thanks in advance

Sudhir Bastakoti said...

@anonymous:
in function videologin, do like this:
function videologin() {
$this->load->helper('video');
echo video_login();
}
and create video_helper in helpers application/helpers folder
and in video_helper.php file
function video_login() {
$CI =& get_instance();
$userId = 0;
//get user id from session
//get username from session or database
$rtmp_server="rtmp://your.rtmp.address/videowhisper";


$rtmp_amf="AMF3";
$loggedin = 1;
$userType = 0;
$admin=0;
$room = "Lobby"; //you can change this to get it from database if set there
$filterRegex=urlencode("(?i)(fuck|cunt)(?-i)");
$filterReplace=urlencode(" ** ");
$username = urlencode($username);
$room = urlencode($room);
$welcome = urlencode($welcome);
$msg = urlencode($msg);
$layoutCode = urlencode($layoutCode);
return "server=$rtmp_server&serverAMF=$rtmp_amf&username=$username&loggedin=$loggedin&userType=$userType&administrator=$admin&room=$room&welcome=$welcome&userPicture=$userPicture&userLink=$userLink&webserver=&msg=$msg&tutorial=0&room_delete=0&room_create=1&file_upload=1&file_delete=0&panelFiles=1&showTimer=1&showCredit=0&disconnectOnTimeout=0&camWidth=320&camHeight=240&camFPS=15&micRate=11&camBandwidth=32768&bufferLive=0.5&bufferFull=0.5&bufferLivePlayback=0.2&bufferFullPlayback=0.5&showCamSettings=1&advancedCamSettings=1&camMaxBandwidth=81920&configureSource=0&disableVideo=0&disableSound=0&background_url=&autoViewCams=1&layoutCode=$layoutCode&fillWindow=0&filterRegex=$filterRegex&filterReplace=$filterReplace&loadstatus=1";
}

Anonymous said...

hello Sudhir Bastakoti,

first thanks for you help. I have fixed the php files. but now I have a new question about it.

when I run videowhisper_conference.php and all php files work fine but all images could not be found. Could you please let me know how you handle all imges links? I really appreciate you.

Sudhir Bastakoti said...

Hi,
I could not get your point.. "images could not be found". Do you mean images are not being displayed or something else.. Could you please elaborate a little.
As for the images, videowhisper gets all the icons from emoticons folder using emoticons.xml file.