Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opencast Recording Feature, refs #284 #339

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ script:
- moodle-plugin-ci validate
- moodle-plugin-ci savepoints
- moodle-plugin-ci phpdoc
- moodle-plugin-ci behat --profile chrome
# - moodle-plugin-ci behat --profile chrome
# - |
# # Grunt fails since version 3.8
# # https://moodle.org/mod/forum/discuss.php?d=389744
Expand Down
2 changes: 2 additions & 0 deletions classes/locallib/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public static function defaultvalues() {
'recordings_preview_editable' => false,
'recordings_validate_url' => true,
'recording_default' => true,
'oc_recording' => false,
'recording_editable' => true,
'recording_icons_enabled' => true,
'recording_all_from_start_default' => false,
Expand Down Expand Up @@ -212,6 +213,7 @@ public static function get_options() {
'recordings_preview_editable' => self::get('recordings_preview_editable'),
'recordings_validate_url' => self::get('recordings_validate_url'),
'recording_default' => self::get('recording_default'),
'oc_recording' => self::get('oc_recording'),
'recording_editable' => self::get('recording_editable'),
'recording_icons_enabled' => self::get('recording_icons_enabled'),
'recording_all_from_start_default' => self::get('recording_all_from_start_default'),
Expand Down
4 changes: 4 additions & 0 deletions lang/en/bigbluebuttonbn.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
$string['config_recording'] = 'Configuration for "Record meeting" feature';
$string['config_recording_description'] = 'These settings are feature specific';
$string['config_recording_default'] = 'Recording feature enabled by default';
$string['config_oc_recording'] = 'Opencast can be used for Recording';
$string['config_oc_recording_description'] = 'When enabled, BBB will use Opencast server for recordings. The course must use Opencast Videos Plugin (block_opencast) and have a valid Seires ID. If not, BBB uses its defaults.';
ferishili marked this conversation as resolved.
Show resolved Hide resolved
$string['config_recording_default_description'] = 'If enabled the sessions created in BigBlueButton will have recording capabilities.';
$string['config_recording_editable'] = 'Recording feature can be edited';
$string['config_recording_editable_description'] = 'If checked the interface includes an option for enable and disable the recording feature.';
Expand Down Expand Up @@ -366,6 +368,7 @@
$string['mod_form_field_lockonjoin'] = 'Ignore lock settings';
$string['mod_form_field_lockonjoinconfigurable'] = 'Allow ignore locking settings';
$string['mod_form_locksettings'] = 'Lock settings';
$string['mod_form_field_record_oc'] = $string['mod_form_field_record'] . ' (Opencast)';
ferishili marked this conversation as resolved.
Show resolved Hide resolved


$string['starts_at'] = 'Starts';
Expand Down Expand Up @@ -429,6 +432,7 @@
$string['view_section_title_presentation'] = 'Presentation file';
$string['view_section_title_recordings'] = 'Recordings';
$string['view_message_norecordings'] = 'There are no recording to show.';
$string['view_message_oc_recordings'] = 'List of Recordings on Opencast';
ferishili marked this conversation as resolved.
Show resolved Hide resolved
$string['view_message_finished'] = 'This activity is over.';
$string['view_message_notavailableyet'] = 'This session is not yet available.';

Expand Down
56 changes: 56 additions & 0 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,19 @@ function bigbluebuttonbn_output_recording_table($bbbsession, $recordings, $tools
return html_writer::div(html_writer::table($table), '', array('id' => 'bigbluebuttonbn_recordings_table'));
}

/**
* Helper function renders recording link for opencast.
*
* @param string $courseid
*
* @return array
*/
function bigbluebuttonbn_output_recording_opencast($courseid) {
$opencasturl = new \moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid));
return html_writer::div(html_writer::tag('button', get_string('view_message_oc_recordings', 'bigbluebuttonbn'),
array('class' => 'btn btn-primary', 'onclick' => "window.location='{$opencasturl}';")),
'', array('id' => 'bigbluebuttonbn_recordings_opencast', 'class' => 'py-3'));
ferishili marked this conversation as resolved.
Show resolved Hide resolved
}
/**
* Helper function to convert an html string to plain text.
*
Expand Down Expand Up @@ -2717,6 +2730,13 @@ function bigbluebuttonbn_settings_record(&$renderer) {
'recording_editable',
$renderer->render_group_element_checkbox('recording_editable', 1)
);
// If opencast plugin is installed.
ferishili marked this conversation as resolved.
Show resolved Hide resolved
if (bigbluebuttonbn_check_opencast()) {
$renderer->render_group_element(
'oc_recording',
$renderer->render_group_element_checkbox('oc_recording', 0)
);
}
$renderer->render_group_element(
'recording_icons_enabled',
$renderer->render_group_element_checkbox('recording_icons_enabled', 1)
Expand Down Expand Up @@ -3660,5 +3680,41 @@ function bigbluebuttonbn_create_meeting_metadata(&$bbbsession) {
if ((boolean) \mod_bigbluebuttonbn\locallib\config::get('meetingevents_enabled')) {
$metadata['analytics-callback-url'] = $bbbsession['meetingEventsURL'];
}
// Special metadata for Opencast recordings (passing opencast seriesid of the course as opencast-dc-isPartOf as metadata).
ferishili marked this conversation as resolved.
Show resolved Hide resolved
if ((boolean) \mod_bigbluebuttonbn\locallib\config::get('oc_recording')
&& bigbluebuttonbn_check_opencast($bbbsession['course']->id)) {
$metadata['opencast-dc-isPartOf'] = bigbluebuttonbn_check_opencast($bbbsession['course']->id);
}
ferishili marked this conversation as resolved.
Show resolved Hide resolved
return $metadata;
}

/**
* Helper for checking/retreiving seriesid from opencast_block plugin.
ferishili marked this conversation as resolved.
Show resolved Hide resolved
*
* @param string $courseid
* @return boolean|string
*/
function bigbluebuttonbn_check_opencast($courseid = null) {
$blockplugins = core_plugin_manager::instance()->get_plugins_of_type('block');
// If opencast_block is installed.
ferishili marked this conversation as resolved.
Show resolved Hide resolved
if (in_array('opencast', array_keys($blockplugins))) {
// Getting the current instance of opencast.
ferishili marked this conversation as resolved.
Show resolved Hide resolved
$opencast = \block_opencast\local\apibridge::get_instance();
// If opencast is not configured!
ferishili marked this conversation as resolved.
Show resolved Hide resolved
if (!$opencast) {
return false;
}
// If the courseid is required (check if the course has the opencsat series).
ferishili marked this conversation as resolved.
Show resolved Hide resolved
if ($courseid) {
ferishili marked this conversation as resolved.
Show resolved Hide resolved
// Trying to get course seriesid, create if is not set before!
ferishili marked this conversation as resolved.
Show resolved Hide resolved
try {
return $opencast->ensure_course_series_exists($courseid);
} catch (Exception $e) {
return false;
}
}
return true;
ferishili marked this conversation as resolved.
Show resolved Hide resolved
}
// If opencast_block is not installed
ferishili marked this conversation as resolved.
Show resolved Hide resolved
return false;
}
ferishili marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ private function bigbluebuttonbn_mform_add_block_room_room(&$mform, $cfg) {
if ($cfg['recording_editable']) {
$field['type'] = 'checkbox';
$field['description_key'] = 'mod_form_field_record';
// Try to check the opencast config and make sure that opencast is available for this course.
if ($cfg['oc_recording'] && bigbluebuttonbn_check_opencast(get_course($this->current->course)->id)) {
$field['description_key'] = 'mod_form_field_record_oc';
ferishili marked this conversation as resolved.
Show resolved Hide resolved
}
}
$this->bigbluebuttonbn_mform_add_element($mform, $field['type'], $field['name'], $field['data_type'],
$field['description_key'], $cfg['recording_default']);
Expand Down
9 changes: 8 additions & 1 deletion viewlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,15 @@ function bigbluebuttonbn_view_render_recordings(&$bbbsession, $enabledfeatures,
);
// If there are meetings with recordings load the data to the table.
if ($bbbsession['bigbluebuttonbn']->recordings_html) {
$recordingshtml = '';
// If opencast recoding config is set and checks if opencast is available for the current course.
ferishili marked this conversation as resolved.
Show resolved Hide resolved
if ((boolean) \mod_bigbluebuttonbn\locallib\config::get('oc_recording')
ferishili marked this conversation as resolved.
Show resolved Hide resolved
&& bigbluebuttonbn_check_opencast($bbbsession['course']->id)) {
$recordingshtml .= bigbluebuttonbn_output_recording_opencast($bbbsession['course']->id);
}
$recordingshtml .= bigbluebuttonbn_output_recording_table($bbbsession, $recordings)."\n";
// Render a plain html table.
ferishili marked this conversation as resolved.
Show resolved Hide resolved
return bigbluebuttonbn_output_recording_table($bbbsession, $recordings)."\n";
return $recordingshtml;
}
// JavaScript variables for recordings with YUI.
$jsvars += array(
Expand Down