diff --git a/classes/webservice.php b/classes/webservice.php index ed961926..e8b253db 100644 --- a/classes/webservice.php +++ b/classes/webservice.php @@ -1135,9 +1135,26 @@ public function get_recording_url_list($meetingid) { // Classic: recording:read:admin. // Granular: cloud_recording:read:list_recording_files:admin. $url = 'meetings/' . $this->encode_uuid($meetingid) . '/recordings'; - $response = $this->make_call($url); - if (!empty($response->recording_files)) { + try { + $response = $this->make_call($url); + } catch (not_found_exception $e) { + // If the meeting was not found (1001) or there are no recordings (3301), return an empty array. + return []; + } + + if (empty($response->recording_files)) { + if (!isset($response->recording_count)) { + throw new bad_request_exception('recording_count: undefined', 400); + } + + $recordingcount = (int) $response->recording_count; + $audiocount = count($response->participant_audio_files); + if ($recordingcount !== $audiocount) { + // If there are no recording files and the recording count does not match, throw an exception. + throw new bad_request_exception("recording_count: $recordingcount != participant_audio_files: $audiocount", 400); + } + } else { foreach ($response->recording_files as $recording) { $url = $recording->play_url ?? $recording->download_url ?? null; if (!empty($url) && isset($allowedrecordingtypes[$recording->file_type])) {