Skip to content

OcRecordings

FarbodZamani edited this page Mar 28, 2022 · 3 revisions

This class contains all REST API calls to the /recordings endpoint.

Namespace

It is accessible under OpencastApi\Rest namespace.

How to use

  1. In OpencastApi\OpenCast as its property with OpenCast properties naming convention:
use OpencastApi\OpenCast;
$opencastApi = new OpenCast($config);
$ocRecordings = $opencastApi->recordings;
...
  1. Direct instantiation:
use OpencastApi\Rest\OcRestClient;
use OpencastApi\Rest\OcRecordings;
$ocRestClient = new OcRestClient($config);
$ocRecordings = new OcRecordings($ocRestClient);
...

Functions

Consumable functions are liested below:

getAgentLastModified($agentId)

Retrieves the last modified hash for specified agent. More Detail

  • $agentId (string) ID of capture agent for which the last modified hash will be retrieved.

  • Returns an array: ['code' => 200, 'reason' => 'OK', 'body' => {The last modified hash of agent is in the body of response}]

getConflicts($agent, $start, $end, $format = '', $rrule = '', $duration = 0, $timezone = '')

Searches for conflicting recordings based on parameters and returns result as XML or JSON. (JSON by default | XML on demand). More Detail

  • $agent (string) Device identifier for which conflicts will be searched.

  • $start (int) Start time of conflicting period, in milliseconds.

  • $end (int) End time of conflicting period, in milliseconds.

  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • $rrule (string) (optional) Rule for recurrent conflicting, specified as: "FREQ=WEEKLY;BYDAY=day(s);BYHOUR=hour;BYMINUTE=minute". FREQ is required. BYDAY may include one or more (separated by commas) of the following: SU,MO,TU,WE,TH,FR,SA.

  • $duration (int) (optional) If recurrence rule is specified duration of each conflicting period, in milliseconds . (Default value=0)

  • $timezone (string) (optional) The timezone of the capture device.

  • Returns an array: ['code' => 200, 'body' => '{Found conflicting events, returned in body of response},'reason' => 'OK']

getCurrentCapute($agentId)

Get the current capture event catalog as JSON. More Detail

  • $agentId (string) The agent identifier.

  • Returns an array: ['code' => 200, 'body' => '{JSON (Object) DublinCore of current capture event is in the body of response}','reason' => 'OK']

getCurrentRecording($agentId)

Get the current capture event as XML. More Detail

  • $agentId (string) The agent identifier.

  • Returns an array: ['code' => 200, 'body' => '{XML (text) current event is in the body of response}','reason' => 'OK']

getEventCount()

Get the number of scheduled events. More Detail

  • Returns an array: ['code' => 200, 'body' => '{ The event count }','reason' => 'OK']

getAllRecordings()

Return all registered recordings and their state. More Detail

  • Returns an array: ['code' => 200, 'body' => '{ (Array) all known recordings.}','reason' => 'OK']

getCalenders($agentId = '', $seriesId = '', $cutOff = 0)

Returns iCalendar for specified set of events. More Detail

  • $agentId (string) (optional) Filter events by capture agent.

  • $seriesId (string) (optional) Filter events by series.

  • $cutOff (int) (optional) A cutoff date in UNIX milliseconds to limit the number of events returned in the calendar. (Default value=0)

  • Returns an array: ['code' => 200, 'body' => '{ (Object) Events were modified, new calendar is in the body.}','reason' => 'OK']

getCalendarJSON($agentId = '', $cutOff = 0)

Returns a calendar in JSON format for specified events. This endpoint is not yet stable and might change in the future with no priot notice. More Detail

  • $agentId (string) (optional) Filter events by capture agent.

  • $cutOff (int) (optional) A cutoff date in UNIX milliseconds to limit the number of events returned in the calendar. (Default value=0)

  • Returns an array: ['code' => 200, 'body' => '{ (Object) Calendar for events in JSON format.}']

getEventMediaPackageXML($eventId)

Retrieves media package in XML (text) for specified event. More Detail

  • $eventId (string) ID of event for which media package will be retrieved.

  • Returns an array: ['code' => 200, 'body' => '{ XML (text) DublinCore of event is in the body of response.}','reason' => 'OK']

getRecordingState($recordingId)

Return the state of a given recording. More Detail

  • $recordingId (string) The ID of a given recording.

  • Returns an array: ['code' => 200, 'body' => '{ Returns the state of the recording with the correct id.}']

getTechnicalMetadataJSON($eventId)

Retrieves the technical metadata for specified event as JSON (Object). More Detail

  • $eventId (string) ID of event for which the technical metadata will be retrieved.

  • Returns an array: ['code' => 200, 'body' => '{technical metadata as JSON (Object) of event is in the body of response}']

getEventWorkflowProps($eventId)

Retrieves workflow configuration for specified event. More Detail

  • $eventId (string) ID of event for which workflow configuration will be retrieved.

  • Returns an array: ['code' => 200, 'body' => '{workflow configuration of event is in the body of response}']

getEventCaptureAgentProps($eventId)

Retrieves Capture Agent properties for specified event. More Detail

  • $eventId (string) ID of event for which agent properties will be retrieved.

  • Returns an array: ['code' => 200, 'body' => '{Capture Agent properties of event is in the body of response}']

getEventDublinCore($eventId, $format = '')

Retrieves DublinCore for specified event as XML or JSON. (JSON by default | XML on demand). More Detail

  • $eventId (string) ID of event for which DublinCore will be retrieved.

  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • Returns an array: ['code' => 200, 'body' => '{JSON (Object) ot XML (text) DublinCore of event is in the body of response}']

getRecordings($searchParams = [], $format = '')

Searches recordings and returns result as XML or JSON. (JSON by default | XML on demand). More Detail

  • $searchParams is an optional array that could contain the following:
[
    'agent' => '',      // (optional) Search by device 
    'startsfrom' => 0,  // (optional)  Search by when does event start (in miliseconds) (Default value=0)
    'startsto' => 0,    // (optional)  Search by when does event start (in miliseconds) (Default value=0)
    'endsfrom' => 0,    // (optional) Search by when does event finish (in miliseconds) (Default value=0)
    'endsto' => 0,      // (optional) Search by when does event finish (in miliseconds) (Default value=0)
]
  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • Returns an array: ['code' => 200, 'body' => '{{XML (text) or JSON (Object) formated results}}']

getUpcomingCaptureCatalog($agentId)

Get the upcoming capture event catalog as JSON (Object) More Detail

  • $agentId (string) The agent identifier.

  • Returns an array: ['code' => 200, 'body' => '{DublinCore of the upcomfing capture event is in the body of response}']

getUpcomingCapture($agentId)

Get the upcoming capture event as XML (text). More Detail

  • $agentId (string) The agent identifier.

  • Returns an array: ['code' => 200, 'body' => '{The upcoming capture event as XML (text)}']

deleteRecording($eventId)

Removes scheduled event with specified ID. More Detail

  • $eventId (string) Event ID.

  • Returns an array: ['code' => 200, 'reason' => 'OK'] (Event was successfully removed)

createRecording($start, $end, $agent, $mediaPackage, $users = '', $wfproperties = '', $agentparameters = '', $source = '')

Creates new event with specified parameters. More Detail

  • $start (int) The start date of the event in milliseconds from 1970-01-01T00:00:00Z.

  • $end (int) The end date of the event in milliseconds from 1970-01-01T00:00:00Z.

  • $agent (string) The agent of the event.

  • $mediaPackage (string) The media package of the event.

  • $users (string|array) (optional) Comma separated string or array list of user ids (speakers/lecturers) for the event.

  • $wfproperties (string|array) (optional) Workflow configuration keys for the event. Each key will be prefixed by 'org.opencastproject.workflow.config.' and added to the capture agent parameters.

  • $agentparameters (string|array) (optional) The capture agent properties for the event.

  • $source (string) (optional) The scheduling source of the event.

  • Returns an array: ['code' => 201, 'reason' => 'Created'] (Event is successfully created)

createRecordingsMulti($rrule, $start, $end, $duration, $tz, $agent, $templateMp, $users = '', $wfproperties = '', $agentparameters = '', $source = '')

Creates new event with specified parameters. More Detail

  • $rrule (string) The recurrence rule for the events.

  • $start (int) The start date of the event in milliseconds from 1970-01-01T00:00:00Z.

  • $end (int) The end date of the event in milliseconds from 1970-01-01T00:00:00Z.

  • $duration (int) The duration of the events in milliseconds.

  • $tz (string) The timezone of the events.

  • $agent (string) The agent of the event.

  • $templateMp (string) The template mediapackage for the events.

  • $users (string|array) (optional) Comma separated string or array list of user ids (speakers/lecturers) for the event.

  • $wfproperties (string|array) (optional) Workflow configuration keys for the event. Each key will be prefixed by 'org.opencastproject.workflow.config.' and added to the capture agent parameters.

  • $agentparameters (string|array) (optional) The capture agent properties for the event.

  • $source (string) (optional) The scheduling source of the event.

  • Returns an array: ['code' => 201, 'reason' => 'Created'] (Event is successfully created)

prolongCaptureAgent($agentId)

Prolong an immediate capture. More Detail

  • $agentId (string) The agent identifier.

  • Returns an array: ['code' => 200, 'reason' => 'OK'] (OK if event were successfully prolonged)

removeOldScheduledRecordings($buffer)

This will find and remove any scheduled events before the buffer time to keep performance in the scheduler optimum. More Detail

  • $buffer (int) The amount of seconds before now that a capture has to have stopped capturing. It must be 0 or greater.

  • Returns an array: ['code' => 200, 'reason' => 'OK'] (Removed old scheduled recordings)

removeRecording($recordingId)

Remove record of a given recording. More Detail

  • $recordingId (string) The ID of a given recording.

  • Returns an array: ['code' => 200, 'reason' => 'OK'] ({recordingId} removed)

startCapture($agentId, $workflowDefinitionId = '')

Create an immediate event. More Detail

  • $agentId (string) The agent identifier.

  • $workflowDefinitionId (string) (optional) The workflow definition id to use.

  • Returns an array: ['code' => 201, 'reason' => 'CREATED'] (If events were successfully generated, status CREATED is returned)

stopCapture($agentId)

Stops an immediate capture. More Detail

  • $agentId (string) The agent identifier.

  • Returns an array: ['code' => 200, 'reason' => 'OK'] (OK if event were successfully stopped)

updateRecording($eventId, $start = 0, $end = 0, $agent = '', $users = '', $mediaPackage = '', $wfproperties = '', $agentparameters = '')

Updates specified event. More Detail

  • $eventId (string) ID of event to be updated.

  • $start (int) (optional) Updated start date for event (Default value=0)

  • $end (int) (optional) Updated end date for event (Default value=0)

  • $agent (string) (optional) Updated agent for event.

  • $users (string|array) (optional) Updated comma separated or an array list of user ids (speakers/lecturers) for the event.

  • $mediaPackage (string) (optional) Updated media package for event.

  • $wfproperties (string|array) (optional) Workflow configuration properties.

  • $agentparameters (string|array) (optional) Updated Capture Agent properties.

  • Returns an array: ['code' => 200, 'reason' => 'OK'] (Status OK is returned if event was successfully updated, NOT FOUND if specified event does not exist or BAD REQUEST if data is missing or invalid)

updateRecordingState($recordingId, $state)

Set the status of a given recording, registering it if it is new. More Detail

  • $recordingId (string) The ID of a given recording.

  • $state (string) The state of the recording. Possible values: unknown, capturing, capture_finished, capture_error, manifest, manifest_error, manifest_finished, compressing, compressing_error, uploading, upload_finished, upload_error.

  • Returns an array: ['code' => 200, 'reason' => 'OK'] ({recordingId} set to {state})

Clone this wiki locally