Event
The Event interface defines the normalized structure of Opencast events used by Paella Player. This interface serves as an intermediate data model that doesn’t exactly match any of the source formats (Engage Service or External API), but contains all the essential information needed for video playback and event management.
Event Interface
Section titled “Event Interface”export interface Event { id: string org?: string; acl?: ACL[] metadata?: Metadata; tracks?: Track[] attachments?: Attachment[] catalogs?: Catalog[]; segments?: Segment[]}Properties
Section titled “Properties”id: stringUnique identifier of the event.
org?: stringOrganization to which the event belongs.
acl?: ACL[]Access Control List of the event.
metadata
Section titled “metadata”metadata?: MetadataEvent metadata (title, description, presenters, etc.).
tracks
Section titled “tracks”tracks?: Track[]Media tracks of the event (video, audio).
attachments
Section titled “attachments”attachments?: Attachment[]Files attached to the event.
catalogs
Section titled “catalogs”catalogs?: Catalog[]Catalogs associated with the event.
segments
Section titled “segments”segments?: Segment[]Event segments (for temporal navigation).
ACL (Access Control List)
Section titled “ACL (Access Control List)”export interface ACL { action: string allow: boolean role: string}Defines access permissions for different roles.
Properties
Section titled “Properties”- action: Action being controlled (e.g., “read”, “write”)
- allow: Whether the action is allowed (
true) or denied (false) - role: Role to which the rule applies
Metadata
Section titled “Metadata”export type Metadata = Partial<{ title: string subject: string description: string language: string rightsHolder: string license: string series: string seriesTitle: string presenters: string[] contributors: string[] startDate: Date duration: number location: string source: string created: Date // ... more properties}>Contains descriptive information of the event.
Main properties
Section titled “Main properties”- title: Event title
- description: Event description
- presenters: List of presenters
- contributors: List of contributors
- startDate: Event start date
- duration: Duration in seconds
- series: ID of the series it belongs to
- seriesTitle: Series title
- language: Event language
- location: Location where it was recorded
export interface Track { id: string type: string mimetype: string url: string duration?: number // ... more properties}Represents a media track (video or audio).
Properties
Section titled “Properties”- id: Unique track identifier
- type: Track type (e.g., “presenter/source”, “presentation/source”)
- mimetype: File MIME type
- url: Media track URL
- duration: Track duration
Attachment
Section titled “Attachment”export interface Attachment { id: string type: string mimetype: string url: string // ... more properties}Represents a file attached to the event.
Catalog
Section titled “Catalog”export interface Catalog { id: string type: string mimetype: string url: string // ... more properties}Represents a catalog associated with the event.
Segment
Section titled “Segment”export interface Segment { time: number duration?: number title?: string // ... more properties}Represents a temporal segment of the event.
Data sources
Section titled “Data sources”The Event interface normalizes data that can come from two different sources in Opencast:
1. Engage Service
Section titled “1. Engage Service”Traditional Opencast service for content delivery.
2. External API
Section titled “2. External API”Opencast external API that provides programmatic access to events.
Event conversion
Section titled “Event conversion”The package includes specific converters to transform data from these sources to the Event format:
- EngageEventConversor: For events from the Engage service
- APIEventConversor: For events from the external API
Usage example
Section titled “Usage example”import { OpencastPaellaPlayer } from '@asicupv/paella-opencast-core';
const player = new OpencastPaellaPlayer('container', { // configuration...});
// Get the current eventconst event = player.getEvent();
// Access metadataconsole.log('Title:', event.metadata?.title);console.log('Presenters:', event.metadata?.presenters);console.log('Duration:', event.metadata?.duration);
// Access media tracksevent.tracks?.forEach(track => { console.log(`Track ${track.type}: ${track.url}`);});
// Check access permissionsconst canRead = event.acl?.some(acl => acl.action === 'read' && acl.allow);