Merge branch 'MDL-83570-405' of https://github.com/meirzamoodle/moodle into MOODLE_405_STABLE

This commit is contained in:
Huong Nguyen 2024-11-20 16:11:22 +07:00
commit 5ae0bf0a12
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
5 changed files with 35 additions and 3 deletions

View File

@ -39,4 +39,7 @@ class constants {
/** @var string TINYRECORDRTC_SCREEN_FHD The Full-HD screen-sharing resolution. */
public const TINYRECORDRTC_SCREEN_FHD = '1920,1080';
/** @var array TINYRECORDRTC_AUDIO_BITRATES The audio bitrate options. */
public const TINYRECORDRTC_AUDIO_BITRATES = [24000, 32000, 48000, 64000, 96000, 128000, 160000, 192000, 256000, 320000];
}

View File

@ -45,6 +45,24 @@ function xmldb_tiny_recordrtc_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2024042400, 'tiny', 'recordrtc');
}
if ($oldversion < 2024100701) {
// The input bitrate to be converted.
$currentbitrate = get_config('tiny_recordrtc', 'audiobitrate');
// Supported bitrates.
$supportedbitrates = \tiny_recordrtc\constants::TINYRECORDRTC_AUDIO_BITRATES;
// Find the nearest value.
usort($supportedbitrates, fn($a, $b) => abs($currentbitrate - $a) <=> abs($currentbitrate - $b));
$nearestbitrate = $supportedbitrates[0];
// Update the bitrate setting with the nearest supported bitrate.
set_config('audiobitrate', $nearestbitrate, 'tiny_recordrtc');
// Main savepoint reached.
upgrade_main_savepoint(true, 2024100701);
}
// Automatically generated Moodle v4.5.0 release upgrade line.
// Put any upgrade step following this.

View File

@ -54,6 +54,7 @@ $string['gumtype'] = 'Tried to get stream from the webcam/microphone/screen, but
$string['gumtype_title'] = 'No constraints specified';
$string['insecurealert'] = 'Your browser might not allow this plugin to work unless it is used either over HTTPS or from localhost.';
$string['insecurealert_title'] = 'Insecure connection!';
$string['kbrate'] = '{$a} kb/s';
$string['maxfilesizehit'] = 'You have reached the maximum size limit for file uploads.';
$string['maxfilesizehit_title'] = 'Recording stopped';
$string['norecordingfound'] = 'Something has gone wrong. Nothing has been recorded.';

View File

@ -61,8 +61,18 @@ if ($ADMIN->fulltree) {
// Audio bitrate.
$name = get_string('audiobitrate', 'tiny_recordrtc');
$desc = get_string('audiobitrate_desc', 'tiny_recordrtc');
$default = '128000';
$setting = new admin_setting_configtext('tiny_recordrtc/audiobitrate', $name, $desc, $default, PARAM_INT, 8);
$options = [];
foreach (\tiny_recordrtc\constants::TINYRECORDRTC_AUDIO_BITRATES as $rate) {
$kbrate = $rate / 1000;
$options[$rate] = get_string('kbrate', 'tiny_recordrtc', $kbrate);
}
$setting = new admin_setting_configselect(
name: 'tiny_recordrtc/audiobitrate',
visiblename: $name,
description: $desc,
defaultsetting: \tiny_recordrtc\constants::TINYRECORDRTC_AUDIO_BITRATES[5],
choices: $options,
);
$settings->add($setting);
// Video bitrate.

View File

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024100700;
$plugin->version = 2024100701;
$plugin->requires = 2024100100;
$plugin->component = 'tiny_recordrtc';