About
You can embed multiple players on the same page by including the embed_factory=true parameter in the player script URL.
Previously, loading multiple dynamic or thumbnail embeds on the same page could cause conflicts, as player scripts shared a global scope and overwrote each other. This often required using iframe embeds as a workaround.
The embed_factory parameter resolves this by isolating each player instance, allowing multiple players to run independently on the same page, even when using different uiConfId values.
How it works
When this parameter is included in the player script URL, each script creates its own isolated player instance. This approach avoids the need for iframe embeds while maintaining full isolation between players.
Supported embed types:
- Dynamic embeds (embedPlaykitJs, embedIframeJs)
- Thumbnail embeds (thumbnail-embed.js)
Example
<script type="text/javascript" src="https://api.nvq2.ovp.kaltura.com/p/[PARTNER_ID]/embedPlaykitJs/uiconf_id/24029662?embed_factory=true"></script><script type="text/javascript" src="https://api.nvq2.ovp.kaltura.com/p/[PARTNER_ID]/embedPlaykitJs/uiconf_id/24571992?embed_factory=true"></script>
Place multiple thumbnail embeds on one page
You can place multiple thumbnail embeds on the same page, even with different player configurations. Make sure each targetId matches a unique container ID. If IDs are reused, the player may render in the wrong container.
The following example demonstrates three players on one page: two sharing one uiConfId and a third using a different configuration.
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /><title>Multi-Player Factory Demo</title><script type="text/javascript" src="https://api.nvq2.ovp.kaltura.com/p/242/embedPlaykitJs/uiconf_id/24029662?embed_factory=true"></script><script type="text/javascript" src="https://api.nvq2.ovp.kaltura.com/p/242/embedPlaykitJs/uiconf_id/24571992?embed_factory=true"></script><script src="https://static.kaltura.com/content/static/player-scripts/thumbnail-embed.js"></script></head><body><div id="kaltura_player_1" style="width: 560px; height: 395px"></div><script>__thumbnailEmbed({config: {provider: { partnerId: 242, uiConfId: 24029662 },targetId: "kaltura_player_1"},mediaInfo: { entryId: '0_7jytz63t' }});</script><div id="kaltura_player_2" style="width: 560px; height: 395px"></div><script>__thumbnailEmbed({config: {provider: { partnerId: 242, uiConfId: 24029662 },targetId: "kaltura_player_2"},mediaInfo: { entryId: '0_tymk5eko' }});</script><div id="kaltura_player_3" style="width: 560px; height: 395px"></div><script>__thumbnailEmbed({config: {provider: { partnerId: 242, uiConfId: 24571992 },targetId: "kaltura_player_3"},mediaInfo: { entryId: '0_82hmlgq1' }});</script></body></html>
Place multiple dynamic embeds on one page
Each player instance is scoped by its uiConfId, which prevents conflicts between different configurations. Make sure each targetId matches a unique container ID.
The following example demonstrates two players on one page: one is an audio player and the other is a video player, each playing different content.
<head><script type="text/javascript" src="https://api.nvq2.ovp.kaltura.com/p/242/embedPlaykitJs/uiconf_id/24029662?embed_factory=true"></script><script type="text/javascript" src="https://api.nvq2.ovp.kaltura.com/p/242/embedPlaykitJs/uiconf_id/24843742?embed_factory=true"></script></head><body><div id="kaltura_player_1" style="width: 560px;height: 395px"></div><div id="kaltura_player_2" style="width: 560px;height: 395px"></div><script type="text/javascript">window.addEventListener('load', function() {try {var kalturaPlayer1 = window.KalturaPlayer_24029662.setup({targetId: "kaltura_player_1",provider: { partnerId: 242, uiConfId: 24029662 },});kalturaPlayer1.loadMedia({entryId: '0_7jytz63t'});var kalturaPlayer2 = window.KalturaPlayer_24843742.setup({targetId: "kaltura_player_2",provider: { partnerId: 242, uiConfId: 24843742 },});kalturaPlayer2.loadMedia({entryId: '0_82hmlgq1'});} catch (e) {console.error(e.message)};});</script></body>