Skip to content

Official pattern for multiple players with different uiConfId + CSS isolation #1179

Description

@LutechRaiProgetti5

Summary

Need clarification on the official/recommended approach for embedding multiple Kaltura Player instances with different uiConfId configurations on the same page, and how to prevent CSS contamination between their skins.

Use Case

Common scenario: displaying both video and audio players for the same content with different skins/plugins (e.g., e-learning platform offering visual + audio-only formats).

Current Undocumented Pattern

We're using window.__kalturaplayerdata to preserve separate configs:

// Load bundle 1
await loadScript(embedUrl1);
const config1 = JSON.parse(JSON.stringify(window.__kalturaplayerdata));

// Setup player 1
window.__kalturaplayerdata = config1;
KalturaPlayer.setup({targetId: "player1", provider: {partnerId, uiConfId: uiConf1}});

// Load bundle 2 (overwrites __kalturaplayerdata)
await loadScript(embedUrl2);
const config2 = JSON.parse(JSON.stringify(window.__kalturaplayerdata));

// Setup player 2
window.__kalturaplayerdata = config2;
KalturaPlayer.setup({targetId: "player2", provider: {partnerId, uiConfId: uiConf2}});

Additionally, we remove config.ui.css before setup and manually inject scoped CSS to prevent global contamination:

const cssUrl = config.ui?.css;
if (config.ui) delete config.ui.css;
// Manually inject with @scope(#containerId) { ... }

Questions

  1. Is window.__kalturaplayerdata a stable API or internal implementation detail?
  2. What's the official pattern for multiple players with different uiConfId on one page?
  3. Should CSS isolation be handled manually, or is there a built-in mechanism?
  4. Is this pattern future-proof for v7.x releases?
  5. If this approach is not recommended, what's the official alternative? This use case must be solved — guidance on the correct implementation would be appreciated.

Documentation Gap

The Player v7 docs don't cover:

  • Multi-player scenarios with different configs
  • CSS isolation between players
  • window.__kalturaplayerdata usage and stability

Environment

  • Player: Kaltura Player v7.238 (OVP)
  • Server: api.irp2.ovp.kaltura.com
  • Browsers: Chrome 118+, Firefox 128+, Edge 118+

Request

Please document the official pattern or confirm if the approach above is correct and will remain supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions