You are here

function zoomapi_download_meeting_recordings in Zoom API 7.2

Download Meeting Recordings.

Download the meeting recordings to the specified destination.

1 call to zoomapi_download_meeting_recordings()
zoomapi_download_meeting_recordings_to_entity in ./zoomapi.module
Download meeting recordings for entity.

File

./zoomapi.module, line 860
Main file for the Zoom API module.

Code

function zoomapi_download_meeting_recordings($zoom_meeting_recordings, $destination_directory, $context = []) {
  $filename_prefix = !empty($zoom_meeting_recordings['topic']) ? $zoom_meeting_recordings['topic'] : $zoom_meeting_recordings['id'];
  $files = [];
  drupal_alter('zoomapi_download_meeting_recordings', $zoom_meeting_recordings, $context);
  foreach ($zoom_meeting_recordings['recording_files'] as $zoom_meeting_recording) {
    if ($zoom_meeting_recording['status'] != 'completed') {
      watchdog(__FUNCTION__, 'Unable to download recording !recording_id. The recording has not completed.', [
        '!recording_id' => $zoom_meeting_recording['id'],
      ], WATCHDOG_ERROR);
      $files[$zoom_meeting_recording['id']] = FALSE;
      continue;
    }
    $filename = $filename_prefix . '-' . strtotime($zoom_meeting_recording['recording_start']) . '.' . strtolower($zoom_meeting_recording['file_type']);
    $context['meeting'] = $zoom_meeting_recordings;
    $context['recording'] = $zoom_meeting_recording;
    unset($context['meeting']['recording_files']);
    drupal_alter('zoomapi_meeting_recording_filename', $filename, $context);
    $file = zoomapi_download_recording($zoom_meeting_recording, $destination_directory, $filename, $context);
    $files[$zoom_meeting_recording['id']] = $file;
  }
  return $files;
}