diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index 7446fa6820..16b54c1a86 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -639,41 +639,42 @@ class bbb // the table's primary key), skip this conference continue; } - $recordingParams = array( - 'meetingId' => $mId, //-- OPTIONAL - comma separate if multiple ids - ); - - //To see the recording list in your BBB server do: bbb-record --list - $records = $this->api->getRecordingsWithXmlResponseArray($recordingParams); - - if ($isAdminReport) { - $courseInfo = api_get_course_info_by_id($meetingDB['c_id']); - $this->forceCIdReq($courseInfo['code'], $meetingDB['session_id'], $meetingDB['group_id']); - } $record = []; $recordLink = get_lang('NoRecording'); - if (!empty($records)) { - if (!isset($records['messageKey']) || $records['messageKey'] != 'noRecordings') { - //if you get several recordings here and you used a - // previous version of Chamilo, you might want to - // only keep the last result for each chamilo conf - $record = end($records); - if (!is_array($record) || !isset($record['recordId'])) { - continue; - } + if (empty($meetingDB['video_url'])) { + $recordingParams = ['meetingId' => $mId]; + $records = $this->api->getRecordingsWithXmlResponseArray($recordingParams); - $recordLink = Display::url( - get_lang('ViewRecord')." [~".$record['playbackFormatLength']."']", - $record['playbackFormatUrl'], - array('target' => '_blank') - ); + if (!empty($records)) { + if (!isset($records['messageKey']) || $records['messageKey'] != 'noRecordings') { + $record = end($records); + + if (!is_array($record) || !isset($record['recordId'])) { + continue; + } - if (!$this->isConferenceManager()) { - $record = []; + $this->updateMeetingVideoUrl($meetingDB['id'], $record['playbackFormatUrl']); + + if (!$this->isConferenceManager()) { + $record = []; + } } } + } else { + $record['playbackFormatUrl'] = $meetingDB['video_url']; + } + + $recordLink = Display::url( + get_lang('ViewRecord'), + $record['playbackFormatUrl'], + ['target' => '_blank'] + ); + + if ($isAdminReport) { + $courseInfo = api_get_course_info_by_id($meetingDB['c_id']); + $this->forceCIdReq($courseInfo['code'], $meetingDB['session_id'], $meetingDB['group_id']); } $actionLinks = $this->getActionLinks($meetingDB, $record, $isGlobal, $isAdminReport); @@ -1212,6 +1213,13 @@ class bbb return $return; } + /** + * @param array $meetingInfo + * @param array $recordInfo + * @param bool $isGlobal + * @param bool $isAdminReport + * @return array + */ private function getActionLinks($meetingInfo, $recordInfo, $isGlobal = false, $isAdminReport = false) { $isVisible = $meetingInfo['visibility'] != 0; @@ -1265,4 +1273,18 @@ class bbb return $links; } + + /** + * @param int $meetingId + * @param string $videoUrl + * @return bool|int + */ + public function updateMeetingVideoUrl($meetingId, $videoUrl) + { + return Database::update( + 'plugin_bbb_meeting', + ['video_url' => $videoUrl], + ['id = ?' => intval($meetingId)] + ); + } } diff --git a/plugin/bbb/lib/bbb_plugin.class.php b/plugin/bbb/lib/bbb_plugin.class.php index b789996f63..1bbdc96881 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -102,6 +102,8 @@ class BBBPlugin extends Plugin visibility TINYINT NOT NULL DEFAULT 1, voice_bridge INT NOT NULL DEFAULT 1, access_url INT NOT NULL DEFAULT 1 + video_url TEXT NULL, + has_video_m4v TINYINT NOT NULL DEFAULT 0 )"; Database::query($sql);