From 81c5cf6d57216aae2b41c04e72e7a90591005a12 Mon Sep 17 00:00:00 2001 From: Elvin Bounphengsy Date: Mon, 4 Mar 2024 14:29:34 -0500 Subject: [PATCH 1/6] Differentiate between different recording types --- classes/task/get_meeting_recordings.php | 24 +++++++++++++++++++++--- classes/webservice.php | 21 +++++++++++++++++++-- lang/en/zoom.php | 21 +++++++++++++++++++-- 3 files changed, 59 insertions(+), 7 deletions(-) diff --git a/classes/task/get_meeting_recordings.php b/classes/task/get_meeting_recordings.php index 97457569..911b0a66 100644 --- a/classes/task/get_meeting_recordings.php +++ b/classes/task/get_meeting_recordings.php @@ -77,8 +77,25 @@ public function execute() { mtrace('Finding meeting recordings for this account...'); $recordingtypestrings = [ - 'audio' => get_string('recordingtypeaudio', 'mod_zoom'), - 'video' => get_string('recordingtypevideo', 'mod_zoom'), + 'active_speaker' => get_string('recordingtype_active_speaker', 'mod_zoom'), + 'audio_interpretation' => get_string('recordingtype_audio_interpretation', 'mod_zoom'), + 'audio_only' => get_string('recordingtype_audio_only', 'mod_zoom'), + 'audio_transcript' => get_string('recordingtype_audio_transcript', 'mod_zoom'), + 'chat_file' => get_string('recordingtype_chat', 'mod_zoom'), + 'closed_caption' => get_string('recordingtype_closed_caption', 'mod_zoom'), + 'gallery_view' => get_string('recordingtype_gallery', 'mod_zoom'), + 'poll' => get_string('recordingtype_poll', 'mod_zoom'), + 'production_studio' => get_string('recordingtype_production_studio', 'mod_zoom'), + 'shared_screen' => get_string('recordingtype_shared', 'mod_zoom'), + 'shared_screen_with_gallery_view' => get_string('recordingtype_shared_gallery', 'mod_zoom'), + 'shared_screen_with_speaker_view' => get_string('recordingtype_shared_speaker', 'mod_zoom'), + 'shared_screen_with_speaker_view(CC)' => get_string('recordingtype_shared_speaker_cc', 'mod_zoom'), + 'sign_interpretation' => get_string('recordingtype_sign', 'mod_zoom'), + 'speaker_view' => get_string('recordingtype_speaker', 'mod_zoom'), + 'summary' => get_string('recordingtype_summary', 'mod_zoom'), + 'summary_next_steps' => get_string('recordingtype_summary_next_steps', 'mod_zoom'), + 'summary_smart_chapters' => get_string('recordingtype_summary_smart_chapters', 'mod_zoom'), + 'timeline' => get_string('recordingtype_timeline', 'mod_zoom'), ]; $localmeetings = zoom_get_all_meeting_records(); @@ -116,6 +133,8 @@ public function execute() { if (empty($meetings[$recording->meetingid])) { // Skip meetings that are not in Moodle. + + var_dump($recording); mtrace('Meeting id: ' . $recording->meetingid . ' does not exist...skipping'); continue; } @@ -131,7 +150,6 @@ public function execute() { } $zoom = $meetings[$recording->meetingid]; - $recordingtype = $recording->recordingtype; $recordingtypestring = $recordingtypestrings[$recordingtype]; diff --git a/classes/webservice.php b/classes/webservice.php index f32c6299..1f49771f 100644 --- a/classes/webservice.php +++ b/classes/webservice.php @@ -994,6 +994,9 @@ public function get_recording_url_list($meetingid) { $allowedrecordingtypes = [ 'MP4' => 'video', 'M4A' => 'audio', + 'TRANSCRIPT' => 'transcript', + 'CHAT' => 'chat', + 'CC' => 'captions', ]; try { @@ -1008,7 +1011,7 @@ public function get_recording_url_list($meetingid) { $recordinginfo->meetinguuid = $response->uuid; $recordinginfo->url = $recording->play_url; $recordinginfo->filetype = $recording->file_type; - $recordinginfo->recordingtype = $allowedrecordingtypes[$recording->file_type]; + $recordinginfo->recordingtype = $recording->recording_type; $recordinginfo->passcode = $response->password; $recordinginfo->recordingstart = strtotime($recording->recording_start); @@ -1041,6 +1044,9 @@ public function get_user_recordings($userid, $from, $to) { $allowedrecordingtypes = [ 'MP4' => 'video', 'M4A' => 'audio', + 'TRANSCRIPT' => 'transcript', + 'CHAT' => 'chat', + 'CC' => 'captions', ]; try { @@ -1057,7 +1063,18 @@ public function get_user_recordings($userid, $from, $to) { $recordinginfo->meetinguuid = $meeting->uuid; $recordinginfo->url = $recording->play_url; $recordinginfo->filetype = $recording->file_type; - $recordinginfo->recordingtype = $allowedrecordingtypes[$recording->file_type]; + $recordinginfo->recordingtype = $recording->recording_type; + $recordinginfo->recordingstart = strtotime($recording->recording_start); + + $recordings[$recording->id] = $recordinginfo; + }else if (!empty($recording->download_url) && isset($allowedrecordingtypes[$recording->file_type])) { + $recordinginfo = new stdClass(); + $recordinginfo->recordingid = $recording->id; + $recordinginfo->meetingid = $meeting->id; + $recordinginfo->meetinguuid = $meeting->uuid; + $recordinginfo->url = $recording->download_url; + $recordinginfo->filetype = $recording->file_type; + $recordinginfo->recordingtype = $recording->recording_type; $recordinginfo->recordingstart = strtotime($recording->recording_start); $recordings[$recording->id] = $recordinginfo; diff --git a/lang/en/zoom.php b/lang/en/zoom.php index 2c7b9d7a..0d8af334 100644 --- a/lang/en/zoom.php +++ b/lang/en/zoom.php @@ -334,8 +334,25 @@ $string['recordingshowtoggle'] = 'Toggle Show Recording'; $string['recordingurl'] = 'Recording URL'; $string['recordingview'] = 'View Recordings'; -$string['recordingtypeaudio'] = 'Audio only'; -$string['recordingtypevideo'] = 'Video and Audio'; +$string['recordingtype_active_speaker'] = 'Active Speaker'; +$string['recordingtype_audio_interpretation'] = 'Audio Interpretation'; +$string['recordingtype_audio_only'] = 'Audio Only'; +$string['recordingtype_audio_transcript'] = 'Audio Transcript'; +$string['recordingtype_chat'] = 'Chat File'; +$string['recordingtype_closed_caption'] = 'Closed Caption'; +$string['recordingtype_gallery'] = 'Gallery View'; +$string['recordingtype_poll'] = 'Poll'; +$string['recordingtype_production_studio'] = 'Production Studio'; +$string['recordingtype_shared'] = 'Shared Screen'; +$string['recordingtype_shared_gallery'] = 'Shared Screen with Gallery View'; +$string['recordingtype_shared_speaker'] = 'Shared Screen with Speaker View'; +$string['recordingtype_shared_speaker_cc'] = 'Shared Screen with Speaker View (CC)'; +$string['recordingtype_sign'] = 'Sign Interpretation'; +$string['recordingtype_speaker'] = 'Speaker View'; +$string['recordingtype_summary'] = 'Summary'; +$string['recordingtype_summary_next_steps'] = 'Summary Next Steps'; +$string['recordingtype_summary_smart_chapters'] = 'Summary Smart Chapters'; +$string['recordingtype_timeline'] = 'Timeline'; $string['recordingvisibility'] = 'Are recordings for this meeting visible by default?'; $string['recordingvisibility_help'] = 'When new recordings for this meeting are fetched, should they be visible in Moodle by default?'; $string['recurrencetype'] = 'Recurrence'; From b5b7b873dc00581df33cd3a1062cae4bb1b978fe Mon Sep 17 00:00:00 2001 From: Elvin Bounphengsy Date: Mon, 4 Mar 2024 15:06:32 -0500 Subject: [PATCH 2/6] Corrected syntax to satisfy code checker --- classes/webservice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/webservice.php b/classes/webservice.php index 1f49771f..e3137885 100644 --- a/classes/webservice.php +++ b/classes/webservice.php @@ -1067,7 +1067,7 @@ public function get_user_recordings($userid, $from, $to) { $recordinginfo->recordingstart = strtotime($recording->recording_start); $recordings[$recording->id] = $recordinginfo; - }else if (!empty($recording->download_url) && isset($allowedrecordingtypes[$recording->file_type])) { + } else if (!empty($recording->download_url) && isset($allowedrecordingtypes[$recording->file_type])) { $recordinginfo = new stdClass(); $recordinginfo->recordingid = $recording->id; $recordinginfo->meetingid = $meeting->id; From c5ee8679e3219ee94f3d3394b1585f701af9cc7b Mon Sep 17 00:00:00 2001 From: Elvin Bounphengsy Date: Wed, 13 Mar 2024 22:51:45 -0400 Subject: [PATCH 3/6] Update classes/task/get_meeting_recordings.php Co-authored-by: Jonathan Champ --- classes/task/get_meeting_recordings.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/classes/task/get_meeting_recordings.php b/classes/task/get_meeting_recordings.php index 911b0a66..5680d047 100644 --- a/classes/task/get_meeting_recordings.php +++ b/classes/task/get_meeting_recordings.php @@ -133,8 +133,6 @@ public function execute() { if (empty($meetings[$recording->meetingid])) { // Skip meetings that are not in Moodle. - - var_dump($recording); mtrace('Meeting id: ' . $recording->meetingid . ' does not exist...skipping'); continue; } From 84c42477509789a35c9a7358891ac0118462fa93 Mon Sep 17 00:00:00 2001 From: Elvin Bounphengsy Date: Thu, 21 Mar 2024 10:46:53 -0400 Subject: [PATCH 4/6] Moved recordingtype string function. Added check to update existing names. --- classes/task/get_meeting_recordings.php | 35 ++++++------------------- classes/webservice.php | 14 ++-------- recordings.php | 34 +++++++++++++++++++++++- 3 files changed, 43 insertions(+), 40 deletions(-) diff --git a/classes/task/get_meeting_recordings.php b/classes/task/get_meeting_recordings.php index 5680d047..e8123e48 100644 --- a/classes/task/get_meeting_recordings.php +++ b/classes/task/get_meeting_recordings.php @@ -76,28 +76,6 @@ public function execute() { mtrace('Finding meeting recordings for this account...'); - $recordingtypestrings = [ - 'active_speaker' => get_string('recordingtype_active_speaker', 'mod_zoom'), - 'audio_interpretation' => get_string('recordingtype_audio_interpretation', 'mod_zoom'), - 'audio_only' => get_string('recordingtype_audio_only', 'mod_zoom'), - 'audio_transcript' => get_string('recordingtype_audio_transcript', 'mod_zoom'), - 'chat_file' => get_string('recordingtype_chat', 'mod_zoom'), - 'closed_caption' => get_string('recordingtype_closed_caption', 'mod_zoom'), - 'gallery_view' => get_string('recordingtype_gallery', 'mod_zoom'), - 'poll' => get_string('recordingtype_poll', 'mod_zoom'), - 'production_studio' => get_string('recordingtype_production_studio', 'mod_zoom'), - 'shared_screen' => get_string('recordingtype_shared', 'mod_zoom'), - 'shared_screen_with_gallery_view' => get_string('recordingtype_shared_gallery', 'mod_zoom'), - 'shared_screen_with_speaker_view' => get_string('recordingtype_shared_speaker', 'mod_zoom'), - 'shared_screen_with_speaker_view(CC)' => get_string('recordingtype_shared_speaker_cc', 'mod_zoom'), - 'sign_interpretation' => get_string('recordingtype_sign', 'mod_zoom'), - 'speaker_view' => get_string('recordingtype_speaker', 'mod_zoom'), - 'summary' => get_string('recordingtype_summary', 'mod_zoom'), - 'summary_next_steps' => get_string('recordingtype_summary_next_steps', 'mod_zoom'), - 'summary_smart_chapters' => get_string('recordingtype_summary_smart_chapters', 'mod_zoom'), - 'timeline' => get_string('recordingtype_timeline', 'mod_zoom'), - ]; - $localmeetings = zoom_get_all_meeting_records(); $now = time(); @@ -127,7 +105,12 @@ public function execute() { foreach ($zoomrecordings as $recordingid => $recording) { if (isset($localrecordings[$recording->meetinguuid][$recordingid])) { - mtrace('Recording id: ' . $recordingid . ' exists...skipping'); + mtrace('Recording id: ' . $recordingid . ' exists...verifying current data.'); + if ($localrecordings[$recording->meetinguuid][$recordingid]->name != $meetings[$recording->meetingid]->name) { + $updatemeeting = $localrecordings[$recording->meetinguuid][$recordingid]; + $updatemeeting->name = $meetings[$recording->meetingid]->name; + $DB->update_record('zoom_meeting_recordings', $updatemeeting); + } continue; } @@ -148,17 +131,15 @@ public function execute() { } $zoom = $meetings[$recording->meetingid]; - $recordingtype = $recording->recordingtype; - $recordingtypestring = $recordingtypestrings[$recordingtype]; $record = new stdClass(); $record->zoomid = $zoom->id; $record->meetinguuid = $recording->meetinguuid; $record->zoomrecordingid = $recordingid; - $record->name = trim($zoom->name) . ' (' . $recordingtypestring . ')'; + $record->name = $zoom->name; $record->externalurl = $recording->url; $record->passcode = $meetingpasscodes[$recording->meetinguuid]; - $record->recordingtype = $recordingtype; + $record->recordingtype = $recording->recordingtype; $record->recordingstart = $recording->recordingstart; $record->showrecording = $zoom->recordings_visible_default; $record->timecreated = $now; diff --git a/classes/webservice.php b/classes/webservice.php index e3137885..0a5f3e07 100644 --- a/classes/webservice.php +++ b/classes/webservice.php @@ -1056,7 +1056,8 @@ public function get_user_recordings($userid, $from, $to) { foreach ($response as $meeting) { foreach ($meeting->recording_files as $recording) { - if (!empty($recording->play_url) && isset($allowedrecordingtypes[$recording->file_type])) { + $url = $recording->play_url ?? $recording->download_url ?? null; + if (!empty($url) && isset($allowedrecordingtypes[$recording->file_type])) { $recordinginfo = new stdClass(); $recordinginfo->recordingid = $recording->id; $recordinginfo->meetingid = $meeting->id; @@ -1066,17 +1067,6 @@ public function get_user_recordings($userid, $from, $to) { $recordinginfo->recordingtype = $recording->recording_type; $recordinginfo->recordingstart = strtotime($recording->recording_start); - $recordings[$recording->id] = $recordinginfo; - } else if (!empty($recording->download_url) && isset($allowedrecordingtypes[$recording->file_type])) { - $recordinginfo = new stdClass(); - $recordinginfo->recordingid = $recording->id; - $recordinginfo->meetingid = $meeting->id; - $recordinginfo->meetinguuid = $meeting->uuid; - $recordinginfo->url = $recording->download_url; - $recordinginfo->filetype = $recording->file_type; - $recordinginfo->recordingtype = $recording->recording_type; - $recordinginfo->recordingstart = strtotime($recording->recording_start); - $recordings[$recording->id] = $recordinginfo; } } diff --git a/recordings.php b/recordings.php index ed8dd20f..e1d20acb 100644 --- a/recordings.php +++ b/recordings.php @@ -122,9 +122,10 @@ $recordingshowhtml = html_writer::div($recordingshowbuttonhtml); } + $recordingname = trim($recording->name) . ' (' . zoom_get_recording_type_string($recording->recordingtype). ')'; $params = ['id' => $cm->id, 'recordingid' => $recording->id]; $recordingurl = new moodle_url('/mod/zoom/loadrecording.php', $params); - $recordinglink = html_writer::link($recordingurl, $recording->name); + $recordinglink = html_writer::link($recordingurl, $recordingname); $recordinglinkhtml = html_writer::span($recordinglink, 'recording-link', ['style' => 'margin-right:1rem']); $recordinghtml .= html_writer::div($recordinglinkhtml, 'recording', ['style' => 'margin-bottom:.5rem']); } @@ -135,6 +136,37 @@ } } +function zoom_get_recording_type_string($recordingtype) { + $recordingtypestringmap = [ + 'active_speaker' => 'recordingtype_active_speaker', + 'audio_interpretation' => 'recordingtype_audio_interpretation', + 'audio_only' => 'recordingtype_audio_only', + 'audio_transcript' => 'recordingtype_audio_transcript', + 'chat_file' => 'recordingtype_chat', + 'closed_caption' => 'recordingtype_closed_caption', + 'gallery_view' => 'recordingtype_gallery', + 'poll' => 'recordingtype_poll', + 'production_studio' => 'recordingtype_production_studio', + 'shared_screen' => 'recordingtype_shared', + 'shared_screen_with_gallery_view' => 'recordingtype_shared_gallery', + 'shared_screen_with_speaker_view' => 'recordingtype_shared_speaker', + 'shared_screen_with_speaker_view(CC)' => 'recordingtype_shared_speaker_cc', + 'sign_interpretation' => 'recordingtype_sign', + 'speaker_view' => 'recordingtype_speaker', + 'summary' => 'recordingtype_summary', + 'summary_next_steps' => 'recordingtype_summary_next_steps', + 'summary_smart_chapters' => 'recordingtype_summary_smart_chapters', + 'timeline' => 'recordingtype_timeline', + ]; + + // Return some default string in case new recordingtype values are added in the future. + if (empty($recordingtypestringmap[$recordingtype])) { + return $recordingtype; + } + + return get_string($recordingtypestringmap[$recordingtype], 'mod_zoom'); +} + echo html_writer::table($table); echo $OUTPUT->footer(); From 4805a6b0d300e0e1f77d4d15332fe654beb13e6c Mon Sep 17 00:00:00 2001 From: Jonathan Champ Date: Thu, 14 Mar 2024 11:10:06 -0400 Subject: [PATCH 5/6] phpcs: Moodle Code Checker v3.4.1 --- tests/advanced_passcode_test.php | 2 +- tests/error_handling_test.php | 2 +- tests/get_meeting_reports_test.php | 2 +- tests/mod_zoom_grade_test.php | 2 +- tests/mod_zoom_invitation_test.php | 2 +- tests/mod_zoom_webservice_test.php | 2 +- tests/privacy/mod_zoom_provider_test.php | 2 +- view.php | 1 + 8 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/advanced_passcode_test.php b/tests/advanced_passcode_test.php index 77549162..54d7e87e 100644 --- a/tests/advanced_passcode_test.php +++ b/tests/advanced_passcode_test.php @@ -29,7 +29,7 @@ /** * PHPunit testcase class. */ -class advanced_passcode_test extends basic_testcase { +final class advanced_passcode_test extends basic_testcase { /** * Fake data from get_user_security_settings(). * @var object diff --git a/tests/error_handling_test.php b/tests/error_handling_test.php index 51446625..729a4f1f 100644 --- a/tests/error_handling_test.php +++ b/tests/error_handling_test.php @@ -29,7 +29,7 @@ /** * PHPunit testcase class. */ -class error_handling_test extends basic_testcase { +final class error_handling_test extends basic_testcase { /** * Exception for when the meeting isn't found on Zoom. * @var not_found_exception diff --git a/tests/get_meeting_reports_test.php b/tests/get_meeting_reports_test.php index bd1cde66..273b07b1 100644 --- a/tests/get_meeting_reports_test.php +++ b/tests/get_meeting_reports_test.php @@ -34,7 +34,7 @@ * PHPunit testcase class. * @covers \mod_zoom\task\get_meeting_reports */ -class get_meeting_reports_test extends advanced_testcase { +final class get_meeting_reports_test extends advanced_testcase { /** * Scheduled task object. * @var \mod_zoom\task\get_meeting_reports diff --git a/tests/mod_zoom_grade_test.php b/tests/mod_zoom_grade_test.php index 22fade56..8d8f41ad 100644 --- a/tests/mod_zoom_grade_test.php +++ b/tests/mod_zoom_grade_test.php @@ -29,7 +29,7 @@ /** * PHPunit testcase class. */ -class mod_zoom_grade_test extends advanced_testcase { +final class mod_zoom_grade_test extends advanced_testcase { /** * @var \stdClass Course record. */ diff --git a/tests/mod_zoom_invitation_test.php b/tests/mod_zoom_invitation_test.php index 26f23dc0..9b8f9004 100644 --- a/tests/mod_zoom_invitation_test.php +++ b/tests/mod_zoom_invitation_test.php @@ -34,7 +34,7 @@ * PHPunit testcase class for invitations. * @covers \mod_zoom\invitation */ -class mod_zoom_invitation_test extends advanced_testcase { +final class mod_zoom_invitation_test extends advanced_testcase { /** * Setup to ensure that fixtures are loaded. */ diff --git a/tests/mod_zoom_webservice_test.php b/tests/mod_zoom_webservice_test.php index 1f551931..d126b74f 100644 --- a/tests/mod_zoom_webservice_test.php +++ b/tests/mod_zoom_webservice_test.php @@ -30,7 +30,7 @@ * PHPunit testcase class. * @covers \mod_zoom\webservice */ -class mod_zoom_webservice_test extends advanced_testcase { +final class mod_zoom_webservice_test extends advanced_testcase { /** * @var object Anonymous class to mock \curl. */ diff --git a/tests/privacy/mod_zoom_provider_test.php b/tests/privacy/mod_zoom_provider_test.php index de12490a..85efec3d 100644 --- a/tests/privacy/mod_zoom_provider_test.php +++ b/tests/privacy/mod_zoom_provider_test.php @@ -35,7 +35,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @coversDefaultClass \mod_zoom\privacy\provider */ -class mod_zoom_provider_test extends provider_testcase { +final class mod_zoom_provider_test extends provider_testcase { /** @var object The zoom instance object. */ protected $zoominstance; diff --git a/view.php b/view.php index 9b89a2a3..d946ec9f 100755 --- a/view.php +++ b/view.php @@ -94,6 +94,7 @@ * Get the display name for a Zoom user. * This is wrapped in a function to avoid unnecessary API calls. * + * @package mod_zoom * @param string $zoomuserid Zoom user ID. * @return ?string */ From bfaf268dff896887d1b77ea0e1461e1de505d7c7 Mon Sep 17 00:00:00 2001 From: Jonathan Champ Date: Tue, 26 Mar 2024 20:07:25 -0400 Subject: [PATCH 6/6] recordings: code review fixes; cleanup --- classes/task/get_meeting_recordings.php | 27 ++++++++++++++++--------- classes/webservice.php | 7 ++++--- recordings.php | 7 +++++++ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/classes/task/get_meeting_recordings.php b/classes/task/get_meeting_recordings.php index e8123e48..f50f0740 100644 --- a/classes/task/get_meeting_recordings.php +++ b/classes/task/get_meeting_recordings.php @@ -104,19 +104,26 @@ public function execute() { $zoomrecordings = $service->get_user_recordings($hostid, $from, $to); foreach ($zoomrecordings as $recordingid => $recording) { + if (empty($meetings[$recording->meetingid])) { + // Skip meetings that are not in Moodle. + mtrace('Meeting id: ' . $recording->meetingid . ' does not exist...skipping'); + continue; + } + + $zoom = $meetings[$recording->meetingid]; + if (isset($localrecordings[$recording->meetinguuid][$recordingid])) { mtrace('Recording id: ' . $recordingid . ' exists...verifying current data.'); - if ($localrecordings[$recording->meetinguuid][$recordingid]->name != $meetings[$recording->meetingid]->name) { - $updatemeeting = $localrecordings[$recording->meetinguuid][$recordingid]; - $updatemeeting->name = $meetings[$recording->meetingid]->name; + $localrecording = $localrecordings[$recording->meetinguuid][$recordingid]; + + if ($localrecording->name !== $zoom->name) { + $updatemeeting = (object) [ + 'id' => $localrecording->id, + 'name' => $zoom->name, + ]; $DB->update_record('zoom_meeting_recordings', $updatemeeting); } - continue; - } - if (empty($meetings[$recording->meetingid])) { - // Skip meetings that are not in Moodle. - mtrace('Meeting id: ' . $recording->meetingid . ' does not exist...skipping'); continue; } @@ -130,7 +137,7 @@ public function execute() { } } - $zoom = $meetings[$recording->meetingid]; + $recordingtype = $recording->recordingtype; $record = new stdClass(); $record->zoomid = $zoom->id; @@ -139,7 +146,7 @@ public function execute() { $record->name = $zoom->name; $record->externalurl = $recording->url; $record->passcode = $meetingpasscodes[$recording->meetinguuid]; - $record->recordingtype = $recording->recordingtype; + $record->recordingtype = $recordingtype; $record->recordingstart = $recording->recordingstart; $record->showrecording = $zoom->recordings_visible_default; $record->timecreated = $now; diff --git a/classes/webservice.php b/classes/webservice.php index 0a5f3e07..1f22008c 100644 --- a/classes/webservice.php +++ b/classes/webservice.php @@ -1005,11 +1005,12 @@ public function get_recording_url_list($meetingid) { if (!empty($response->recording_files)) { foreach ($response->recording_files as $recording) { - if (!empty($recording->play_url) && isset($allowedrecordingtypes[$recording->file_type])) { + $url = $recording->play_url ?? $recording->download_url ?? null; + if (!empty($url) && isset($allowedrecordingtypes[$recording->file_type])) { $recordinginfo = new stdClass(); $recordinginfo->recordingid = $recording->id; $recordinginfo->meetinguuid = $response->uuid; - $recordinginfo->url = $recording->play_url; + $recordinginfo->url = $url; $recordinginfo->filetype = $recording->file_type; $recordinginfo->recordingtype = $recording->recording_type; $recordinginfo->passcode = $response->password; @@ -1062,7 +1063,7 @@ public function get_user_recordings($userid, $from, $to) { $recordinginfo->recordingid = $recording->id; $recordinginfo->meetingid = $meeting->id; $recordinginfo->meetinguuid = $meeting->uuid; - $recordinginfo->url = $recording->play_url; + $recordinginfo->url = $url; $recordinginfo->filetype = $recording->file_type; $recordinginfo->recordingtype = $recording->recording_type; $recordinginfo->recordingstart = strtotime($recording->recording_start); diff --git a/recordings.php b/recordings.php index e1d20acb..98d1bacd 100644 --- a/recordings.php +++ b/recordings.php @@ -136,6 +136,13 @@ } } +/** + * Get the display name for a Zoom recording type. + * + * @package mod_zoom + * @param string $recordingtype Zoom recording type. + * @return string + */ function zoom_get_recording_type_string($recordingtype) { $recordingtypestringmap = [ 'active_speaker' => 'recordingtype_active_speaker',