OpencastPaellaPlayer
The OpencastPaellaPlayer class is the main component of the paella-opencast-core package. It extends the Paella class from the @asicupv/paella-core and adds specific functionalities for working with Opencast.
Constructor
Section titled “Constructor”constructor(containerElement: HTMLElement | string, opencastParams: OpencastInitParams = {})Parameters
Section titled “Parameters”- containerElement:
HTMLElement | string- The container element where the player will be mounted - opencastParams:
OpencastInitParams- Opencast-specific initialization parameters (OpencastInitParams)
Properties
Section titled “Properties”opencastPresentationUrl
Section titled “opencastPresentationUrl”readonly opencastPresentationUrl: string | nullBase URL of the Opencast presentations server.
opencastAuth
Section titled “opencastAuth”readonly opencastAuth: OpencastAuthInstance of the Opencast authentication system.
Methods
Section titled “Methods”getUrlFromOpencastServer
Section titled “getUrlFromOpencastServer”getUrlFromOpencastServer(url: string): string | nullBuilds a complete URL based on the Opencast presentations server URL.
Parameters:
url: string - Relative or absolute URL
Returns: The complete URL or null if no presentation URL is configured.
getEvent
Section titled “getEvent”getEvent(): EventGets the Opencast event from the video manifest.
Returns: The Event object containing the event information.
applyOpencastTheme
Section titled “applyOpencastTheme”async applyOpencastTheme(): Promise<void>Applies the Opencast visual theme to the player.
Configuration
Section titled “Configuration”The class accepts extended configuration that includes Opencast-specific options:
export interface OpencastPaellaConfig extends Config { opencast?: { auth?: string; conversionConfig?: ConversionConfig; }}Usage example
Section titled “Usage example”import { OpencastPaellaPlayer } from '@asicupv/paella-opencast-core';
const player = new OpencastPaellaPlayer('player-container', { // player configuration ...});
// Apply Opencast themeawait player.applyOpencastTheme();
// Get event informationconst event = player.getEvent();console.log('Event title:', event.metadata?.title);Additional functionalities
Section titled “Additional functionalities”- Internationalization: Automatically adds language dictionaries for Opencast
- Skin integration: Automatically loads Opencast CSS styles
- URL management: Facilitates the construction of URLs relative to the Opencast server
- Authentication: Integrates the authentication system with the player