Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 400 and 402] [Versions 401 and 402]

(no description)

File Size: 851 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: recording  - X-Ref

The recording entity.

This is utility class that defines a single recording, and provides methods for their local handling locally, and
communication with the bigbluebutton server.

__construct($id = 0, stdClass $record = null, ?array $metadata = null)   X-Ref
Create an instance of this class.

param: int $id If set, this is the id of an existing record, used to load the data.
param: stdClass|null $record If set will be passed to from_record
param: null|array $metadata

get_recordings_for_instance(instance $instance,bool $includeimported = false,bool $onlyimported = false)   X-Ref
Helper function to retrieve recordings from the BigBlueButton.

param: instance $instance
param: bool $includeimported
param: bool $onlyimported
return: recording[] containing the recordings indexed by recordID, each recording is also a

get_recordings_for_course(int $courseid,array $excludedinstanceid = [],bool $includeimported = false,bool $onlyimported = false,bool $includedeleted = false,bool $onlydeleted = false)   X-Ref
Helper function to retrieve recordings from a given course.

param: int $courseid id for a course record or null
param: array $excludedinstanceid exclude recordings from instance ids
param: bool $includeimported
param: bool $onlyimported
param: bool $includedeleted
param: bool $onlydeleted
return: recording[] containing the recordings indexed by recordID, each recording is also a

get_select_for_group($groupmode, $context, $courseid, $groupid = 0, $groupingid = 0)   X-Ref
Get select for given group mode and context

param: int $groupmode
param: \context $context
param: int $courseid
param: int $groupid
param: int $groupingid
return: array

get_basic_select_from_parameters(bool $includedeleted = false,bool $includeimported = false,bool $onlyimported = false,bool $onlydeleted = false)   X-Ref
Get basic sql select from given parameters

param: bool $includedeleted
param: bool $includeimported
param: bool $onlyimported
param: bool $onlydeleted
return: array

define_properties()   X-Ref
Return the definition of the properties of this model.

return: array

get_instance()   X-Ref
Get the instance that this recording relates to.

return: instance

before_update()   X-Ref
Before doing the database update, let's check if we need to update metadata

return: void

create_imported_recording(instance $targetinstance)   X-Ref
Create a new imported recording from current recording

param: instance $targetinstance
return: recording

before_delete()   X-Ref
Delete the recording in the BBB button

return: void

set_name($value)   X-Ref
Set name

param: string $value

set_description($value)   X-Ref
Set Description

param: string $value

set_protected($value)   X-Ref
Recording is protected

param: bool $value

set_starttime($value)   X-Ref
Recording starttime

param: int $value

set_endtime($value)   X-Ref
Recording endtime

param: int $value

set_published($value)   X-Ref
Recording is published

param: bool $value

set_status($value)   X-Ref
Update recording status

param: bool $value

get_possible_meta_name_for_source($sourcetype, $metadata)   X-Ref
Get the real metadata name for the possible source.

param: string $sourcetype the name of the source we look for (name, description...)
param: array $metadata current metadata

remote_meta_convert()   X-Ref
Convert string (metadata) to json object

return: mixed|null

get_description()   X-Ref
Description is stored in the metadata, so we sometimes needs to do some conversion.


get_name()   X-Ref
Name is stored in the metadata


get_playbacks()   X-Ref
List of playbacks for this recording.

return: array[]

get_remote_playback_url(string $type)   X-Ref
Get the playback URL for the specified type.

param: string $type
return: null|string

get_protected()   X-Ref
Is protected. Return null if protected is not implemented.

return: bool|null

get_starttime()   X-Ref
Start time

return: mixed|null

get_endtime()   X-Ref
Start time

return: mixed|null

get_published()   X-Ref
Is published

return: bool

metadata_set($fieldname, $value)   X-Ref
Set locally stored metadata from this instance

param: string $fieldname
param: mixed $value

metadata_get($fieldname)   X-Ref
Get information stored in the recording metadata such as description, name and other info

param: string $fieldname
return: mixed|null

fetch_records(array $selects, array $params)   X-Ref
Fetch all records which match the specified parameters, including all metadata that relates to them.

param: array $selects
param: array $params
return: recording[]

fetch_metadata(bool $force = false)   X-Ref
Fetch metadata

If metadata has changed locally or if it an imported recording, nothing will be done.

param: bool $force
return: array

refresh_metadata_if_required()   X-Ref
Refresh metadata if required.

If this is a protected recording which whose data was not fetched in the current request, then the metadata will
be purged and refetched. This ensures that the url is safe for use with a protected recording.

sync_pending_recordings_from_server(bool $dismissedonly = false)   X-Ref
Synchronise pending recordings from the server.

This function should be called by the check_pending_recordings scheduled task.

param: bool $dismissedonly fetch dismissed recording only