Finished integration of recordings into OpenMeetings plugin - refs BT#7046 refs #5491

1.9.x
Yannick Warnier 11 years ago
parent 74088d4524
commit ca4671c705
  1. 36
      plugin/openmeetings/lib/openmeetings.class.php
  2. 51
      plugin/openmeetings/lib/openmeetings_gateway.php
  3. 12
      plugin/openmeetings/lib/room.class.php
  4. 2
      plugin/openmeetings/start.php

@ -130,6 +130,7 @@ class OpenMeetings
*/
function createMeeting($params)
{
global $_configuration;
//$id = \Database::insert($this->table, $params);
// First, try to see if there is an active room for this course and session
$roomId = null;
@ -156,14 +157,14 @@ class OpenMeetings
$room = new Room();
$room->SID = $this->sessionId;
$room->name = $this->roomName;
$room->roomtypes_id = $room->roomtypes_id;
$room->comment = urlencode(get_lang('Course').': ' . $params['meeting_name'] . ' Plugin for Chamilo');
$room->numberOfPartizipants = $room->numberOfPartizipants;
$room->ispublic = $room->getString('isPublic');
$room->appointment = $room->getString('appointment');
$room->isDemoRoom = $room->getString('isDemoRoom');
$room->demoTime = $room->demoTime;
$room->isModeratedRoom = $room->getString('isModeratedRoom');
//$room->roomtypes_id = $room->roomtypes_id;
$room->comment = urlencode(get_lang('Course').': ' . $params['meeting_name'] . ' - '.$_configuration['software_name']);
//$room->numberOfPartizipants = $room->numberOfPartizipants;
$room->ispublic = $room->getString('isPublic','false');
//$room->appointment = $room->getString('appointment');
//$room->isDemoRoom = $room->getString('isDemoRoom');
//$room->demoTime = $room->demoTime;
//$room->isModeratedRoom = $room->getString('isModeratedRoom');
$roomId = $this->gateway->createRoomWithModAndType($room);
}
@ -181,6 +182,7 @@ class OpenMeetings
$params['room_id'] = $roomId;
$params['c_id'] = api_get_course_int_id();
$params['session_id'] = api_get_session_id();
$params['record'] = ($room->allowRecording?1:0);
$id = \Database::insert($this->table, $params);
@ -382,12 +384,28 @@ class OpenMeetings
foreach ($meetingsList as $meetingDb) {
//$room->rooms_id = $meetingDb['room_id'];
//error_log(__FILE__.'+'.__LINE__.' Meetings found: '.print_r($meetingDb['room_id'],1));
error_log(__FILE__.'+'.__LINE__.' Meetings found: '.print_r($meetingDb,1));
$remoteMeeting = array();
$meetingDb['created_at'] = api_get_local_time($meetingDb['created_at']);
$meetingDb['closed_at'] = (!empty($meetingDb['closed_at'])?api_get_local_time($meetingDb['closed_at']):'');
// Fixed value for now
$meetingDb['participantCount'] = 40;
$rec = $this->gateway->getFlvRecordingsByRoomId($meetingDb['room_id']);
$recordings = array();
$links = array();
$i = 0;
// Links to videos look like these:
// http://video2.openmeetings.com:5080/openmeetings/DownloadHandler?fileName=flvRecording_4.avi&moduleName=lzRecorderApp&parentPath=&room_id=&sid=dfc0cac396d384f59242aa66e5a9bbdd
$link = $this->url . '/DownloadHandler?fileName=%s&moduleName=lzRecorderApp&parentPath=&room_id=%s&sid=%s';
foreach ($rec as $info) {
$recordings[$i]['filename'] = $info['fileHash'];
$recordings[$i]['image'] = $info['previewImage'];
$recordings[$i]['link1'] = sprintf($link,$recordings[$i]['filename'], $meetingDb['room_id'], $this->sessionId);
$recordings[$i]['link2'] = sprintf($link,$info['alternateDownload'], $meetingDb['room_id'], $this->sessionId);
$recordings[$i]['end'] = $info['recordEnd'];
$links[] = $info['fileName'].' '.\Display::url('[1]', $recordings[$i]['link1'], array('target' => '_blank')).' '.\Display::url('[2]', $recordings[$i]['link2'], array('target' => '_blank'));
}
$item['show_links'] = implode('<br />', $links);
// The following code is currently commented because the web service
// says this is not allowed by the SOAP user.

@ -288,23 +288,39 @@ class OpenMeetingsGateway
/**
* Create a new conference room
* @param The room object
* @return The REST call's result
*/
function createRoomWithModAndType($room)
{
$service = 'addRoomWithModerationAndExternalType';
if ($room->allowRecording) {
$service = 'addRoomWithModerationAndRecordingFlags';
} elseif ($room->isAudioOnly) {
$service = 'addRoomWithModerationExternalTypeAndAudioType';
}
$url = $this->getRestUrl("RoomService")
. 'addRoomWithModerationAndExternalType?'
. $service.'?'
. 'SID=' . $room->SID
. '&name=' . $room->roomname
. '&name=' . $room->name
. '&roomtypes_id=' . $room->roomtypes_id
. '&comment='. $room->comment
. '&numberOfPartizipants=' . $room->numberOfPartizipants
. '&ispublic=' . $room->ispublic
. '&appointment=' . $room->appointment
. '&isDemoRoom=' . $room->isDemoRoom
. '&ispublic=' . $this->var_to_str($room->ispublic)
. '&appointment=' . $this->var_to_str($room->appointment)
. '&isDemoRoom=' . $this->var_to_str($room->isDemoRoom)
. '&demoTime=' . $room->demoTime
. '&isModeratedRoom=' . $room->isModeratedRoom
. '&isModeratedRoom=' . $this->var_to_str($room->isModeratedRoom)
. '&externalRoomType=' . $room->externalRoomType;
//error_log($url);
if ($room->allowRecording) {
$url .= '&allowUserQuestions=' . $this->var_to_str($room->allowUserQuestions)
. '&isAudioOnly=' . $this->var_to_str($room->isAudioOnly)
. '&waitForRecording=' . $this->var_to_str($room->waitForRecording)
. '&allowRecording=' . $this->var_to_str($room->allowRecording);
} elseif ($room->isAudioOnly) {
$url .= '&isAudioOnly=' . $this->var_to_str($room->isAudioOnly);
}
error_log($url);
$result = $this->rest->call($url);
if ($this->rest->fault) {
@ -318,7 +334,7 @@ class OpenMeetingsGateway
return $result;
}
}
return - 1;
return -1;
}
/**
@ -338,11 +354,11 @@ class OpenMeetingsGateway
// . "getRoomTypes?"
// . "SID=" . $this->sessionId;
//$url = $this->getRestUrl('JabberService') . 'getAvailableRooms?SID=' . $this->sessionId;
error_log(__FILE__.'+'.__LINE__.' Calling WS: '.$url);
//error_log(__FILE__.'+'.__LINE__.' Calling WS: '.$url);
$result = $this->rest->call($url, "return");
$rooms = array();
foreach ($result as $room) {
error_log(__FILE__.'+'.__LINE__.': one room found on remote: '.print_r($room,1));
//error_log(__FILE__.'+'.__LINE__.': one room found on remote: '.print_r($room,1));
if ($room['externalRoomType'] == $type && count($room['currentusers']) > 0 ) {
$rooms[] = $room;
}
@ -386,6 +402,21 @@ class OpenMeetingsGateway
return $result;
}
/**
* Get list of available recordings made for the given room
* @param int $id Room ID
*/
function getFlvRecordingsByRoomId($id)
{
$url = $this->getRestUrl("RoomService")
. "getFlvRecordingByRoomId?"
. "SID=" . $this->sessionId
. "&roomId=" . urlencode($id);
$result = $this->rest->call($url, "return");
return $result;
}
/**
* Get list of available recordings made by user

@ -34,6 +34,10 @@ class Room
public $demoTime = 0;
public $isModeratedRoom = true;
public $externalRoomType = 'chamilolms';
public $allowUserQuestions = false;
public $isAudioOnly = false;
public $waitForRecording = true;
public $allowRecording = true;
public $chamiloCourseId;
public $chamiloSessionId;
private $table;
@ -42,6 +46,7 @@ class Room
{
$this->table = \Database::get_main_table('plugin_openmeetings');
global $_configuration;
$this->name = 'C'.api_get_real_course_id().'-'.api_get_session_id();
$accessUrl = api_get_access_url($_configuration['access_url']);
$this->externalRoomType = substr($accessUrl['url'],strpos($accessUrl['url'],'://')+3,-1);
if (strcmp($this->externalRoomType,'localhost') == 0) {
@ -63,6 +68,7 @@ class Room
$this->status = $roomData['status'];
$this->name = $roomData['meeting_name'];
$this->comment = $roomData['welcome_msg'];
$this->allowRecording = $roomData['record'];
$this->chamiloCourseId = $roomData['c_id'];
$this->chamiloSessionId = $roomData['session_id'];
}
@ -71,12 +77,16 @@ class Room
/**
* Gets a string from a boolean attribute
* @param string $attribute Name of the attribute
* @param mixed $voidReturn What to return if the value is not defined
* @return string The boolean value expressed as string ('true' or 'false')
*/
public function getString($attribute) {
public function getString($attribute, $voidReturn = false) {
if (empty($attribute)) {
return false;
}
if (!isset($this->$attribute)) {
return $voidReturn;
}
return $this->$attribute?'true':'false';
}
}

@ -18,7 +18,7 @@ if ($om->isServerRunning()) {
if (isset($_GET['launch']) && $_GET['launch'] == 1) {
$meeting_params = array();
$meeting_params['meeting_name'] = api_get_course_id().'-'.api_get_session_id();
$meeting_params['meeting_name'] = 'C'.api_get_course_id().'-'.api_get_session_id();
$meetings = $om->getCourseMeetings();
$selectedMeeting = array();

Loading…
Cancel
Save