Skip to content

OcIngest

FarbodZamani edited this page Jun 12, 2024 · 6 revisions

This class contains all REST API calls to the /ingest 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);
$ocIngest = $opencastApi->ingest;
...
  1. Direct instantiation:
use OpencastApi\Rest\OcRestClient;
use OpencastApi\Rest\OcIngest;
$ocRestClient = new OcRestClient($config);
$ocIngest = new OcIngest($ocRestClient);
...

Functions

Consumable functions are liested below:

createMediaPackage()

Create an empty media package. More Detail

  • Returns an array: ['code' => 200, 'body' => '{XML (text) media package}']

addCatalog($mediaPackage, $flavor, $file, $tags = '')

Add a metadata catalog to a given media package using an input stream. More Detail

  • $mediaPackage (string) The media package.

  • $flavor (string) The kind of media catalog.

  • $file (file stream object) The metadata catalog file.

  • $tags (string) (optional) The tags of the attachment (From v1.3.0)

  • Returns an array: ['code' => 200, 'body' => '{XML (text) augmented media package}']

addCatalogUrl($mediaPackage, $flavor, $url, $tags = '')

Add a metadata catalog to a given media package using an URL. More Detail

  • $mediaPackage (string) The media package.

  • $flavor (string) The kind of media catalog.

  • $url (string) The location of the catalog.

  • $tags (string) (optional) The tags of the attachment (From v1.3.0)

  • Returns an array: ['code' => 200, 'body' => '{XML (text) augmented media package}']

addDCCatalog($mediaPackage, $dublinCore, $flavor = '')

Add a dublincore episode catalog to a given media package. More Detail

  • $mediaPackage (string) The media package.

  • $dublinCore (string) DublinCore catalog.

  • $flavor (string) (optional) DublinCore Flavor (Default value=dublincore/episode)

  • Returns an array: ['code' => 200, 'body' => '{XML (text) augmented media package}']

addAttachment($mediaPackage, $flavor, $file, $tags = '')

Add an attachment to a given media package using an input stream. More Detail

  • $mediaPackage (string) The media package.

  • $flavor (string) The kind of attachment.

  • $file (object) The attachment file.

  • $tags (string) (optional) The tags of the attachment (From v1.3.0)

  • Returns an array: ['code' => 200, 'body' => '{XML (text) augmented media package}']

addAttachmentUrl($mediaPackage, $flavor, $url, $tags = '')

Add an attachment to a given media package using an URL. More Detail

  • $mediaPackage (string) The media package.

  • $flavor (string) The kind of attachment.

  • $url (string) The location of the attachment.

  • $tags (string) (optional) The tags of the attachment (From v1.3.0)

  • Returns an array: ['code' => 200, 'body' => '{XML (text) augmented media package}']

addMediaPackage($flavor = 'presenter/source', $file = null, $params = [], $wdID = '')

Create and ingest media package from media tracks with additional Dublin Core metadata. It is mandatory to set a title for the recording. This can be done with the 'title' form field or by supplying a DC catalog with a title included. More Detail

  • $flavor (string) (optional) The kind of media track. This has to be specified prior to each media track (default: "presenter/source").
  • $file (string) (partially optional) media track file, could be null if mediaUri in $params is defined.
  • $params is an optional array that could contain the following:
[
    'abstract' => '', // Episode metadata value.
    'accessRights' => '', // Episode metadata value.
    'available' => '', // Episode metadata value.
    'contributor' => '', // Episode metadata value.
    'coverage' => '', // Episode metadata value.
    'created' => '', // Episode metadata value.
    'creator' => '', // Episode metadata value.
    'date' => '', // Episode metadata value.
    'description' => '', // Episode metadata value.
    'extent' => '', // Episode metadata value.
    'format' => '', // Episode metadata value.
    'identifier' => '', // Episode metadata value.
    'isPartOf' => '', // Episode metadata value.
    'isReferencedBy' => '', // Episode metadata value.
    'isReplacedBy' => '', // Episode metadata value.
    'language' => '', // Episode metadata value.
    'license' => '', // Episode metadata value.
    'publisher' => '', // Episode metadata value.
    'relation' => '', // Episode metadata value.
    'replaces' => '', // Episode metadata value.
    'rights' => '', // Episode metadata value.
    'rightsHolder' => '', // Episode metadata value.
    'source' => '', // Episode metadata value.
    'spatial' => '', // Episode metadata value.
    'subject' => '', // Episode metadata value.
    'temporal' => '', // Episode metadata value.
    'temporal' => '', // Episode metadata value.
    'title' => '', // Episode metadata value.
    'type' => '', // Episode metadata value.
    'episodeDCCatalogUri' => '', // URL of episode DublinCore Catalog.
    'episodeDCCatalog' => '', // URL of episode DublinCore Catalog.
    'seriesDCCatalogUri' => '', // URL of series DublinCore Catalog 
    'seriesDCCatalog' => '', // Series DublinCore Catalog 
    'acl' => '', // Access control list in XACML or JSON form 
    'tag' => '', // Tag of the next media file
    'mediaUri' => '', // URL of a media track file
]
  • $wdID (string) (optional) Workflow definition id.

  • Returns an array: ['code' => 200, 'body' => '{Ingest successful. Returns workflow instance as XML (text)']

addZippedMediaPackage($zipFile, $workflowDefinitionId, $workflowInstanceId = '')

Create media package from a compressed file containing a manifest.xml document and all media tracks, metadata catalogs and attachments. More Detail

  • $zipFile (object) The compressed (application/zip) media package file.

  • $workflowDefinitionId (string) Workflow definition id.

  • $workflowInstanceId (string) (optional) The workflow instance ID to associate with this zipped mediapackage.

  • Returns an array: ['code' => 200, 'reason' => 'OK'] (The zipped media package is uploaded)

createMediaPackageWithID($id)

Create an empty media package with ID. Overrides Existing Mediapackage. More Detail

  • $id (string) The Id for the new Mediapackage.

  • Returns an array: ['code' => 200, 'body' => '{XML (text) media package}']

discardMediaPackage($mediaPackage)

Discard a media package. More Detail

  • $mediaPackage (string) Given media package to be destroyed.

  • Returns an array: ['code' => 200, 'reason' => 'OK']

addPartialTrack($mediaPackage, $flavor, $file, $startTime = 0)

Add a partial media track to a given media package using an input stream. More Detail

  • $mediaPackage (string) The XML media package as string.

  • $flavor (string) The kind of media track.

  • $file (object) The media track file.

  • $startTime (int) The start time in milliseconds.

  • Returns an array: ['code' => 200, 'body' => '{XML (text) augmented media package}']

addPartialTrackUrl($mediaPackage, $flavor, $url, $startTime = 0)

Add a partial media track to a given media package using an URL. More Detail

  • $mediaPackage (string) The XML media package as string.

  • $flavor (string) The kind of media track.

  • $url (string) The location of the media.

  • $startTime (int) The start time in milliseconds.

  • Returns an array: ['code' => 200, 'body' => '{XML (text) augmented media package}']

addTrack($mediaPackage, $flavor, $file, $tags = '', $progressCallable = null)

Add a media track to a given media package using an input stream. More Detail

  • $mediaPackage (string) The XML media package as string.
  • $flavor (string) The kind of media track.
  • $file (object) The media track file.
  • $tags (string) (optional) The Tags of the media track.
  • $progressCallable (callable) (optional) Defines a function to invoke when transfer progress is made. The function accepts the following positional arguments:
function (
     $downloadTotal: the total number of bytes expected to be downloaded, zero if unknown,
     $downloadedBytes: the number of bytes downloaded so far,
     $uploadTotal: the total number of bytes expected to be uploaded,
     $uploadedBytes: the number of bytes uploaded so far
)
  • Returns an array: ['code' => 200, 'body' => '{XML (text) augmented media package}']

addTrackUrl($mediaPackage, $flavor, $url, $tags = '')

Add a media track to a given media package using an URL. More Detail

  • $mediaPackage (string) The XML media package as string.

  • $flavor (string) The kind of media track.

  • $url (string) The location of the media.

  • $tags (string) (optional) The Tags of the media track.

  • Returns an array: ['code' => 200, 'body' => '{XML (text) augmented media package}']

ingest($mediaPackage, $workflowDefinitionId = '', $workflowInstanceId = '', $workflowConfiguration = [])

Ingest the completed media package into the system. NOTE: In addition to the documented form parameters, workflow parameters are accepted as well. More Detail

  • $mediaPackage (string) The media package.

  • $workflowDefinitionId (string) (optional) Workflow definition id.

  • $workflowInstanceId (string) (optional) The workflow instance ID to associate this ingest with scheduled events.

  • $workflowConfiguration (array) (optional) Workflow configuration parameters in ['key' => 'value'] format (from v1.7).

  • Returns an array: ['code' => 200, 'body' => '{XML (text) media package}']

schedule($mediaPackage, $workflowDefinitionId = '')

Schedule an event based on the given media package. More Detail

  • $mediaPackage (string) The media package.

  • $workflowDefinitionId (string) (optional) Workflow definition id.

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