try now

instant cloud gaming — no download

JS Integration

The YOM embed script (yom-embed.js) gives you full control over the stream experience. It manages iframe creation, player lifecycle events, fullscreen behavior, visibility toggles, and bidirectional communication between your webpage and the game.

Getting Started

Include the embed script on your page:

<script src="https://cdn.yom.net/yom-embed.js"></script>

Then add the required HTML elements:

<!-- Player container — the iframe will be injected here -->
<div class="yom-player-placeholder"
     data-yom-stream-id="1"
     data-game-id="YOUR_GAME_ID"
     style="width: 100%; aspect-ratio: 16/9;">
</div>

<!-- Launch button -->
<input class="yom-name-input" data-yom-stream-id="1" placeholder="Your name">
<button class="yom-launch-button" data-yom-stream-id="1">Play</button>

When the player clicks the button, yom-embed.js creates an iframe inside the placeholder div, connects to YOM, and starts the game stream.

Core Concepts

Required CSS classes

ClassPurpose
.yom-player-placeholderContainer where the stream iframe is created
.yom-launch-buttonButton that initiates the stream
.yom-name-inputOptional text input for player name

Required data attributes

AttributeOnDescription
data-yom-stream-idAll elementsLinks elements to a specific stream instance
data-game-id.yom-player-placeholderYour game’s unique identifier

Optional data attributes

Set these on .yom-player-placeholder to configure behavior:

AttributeValuesDescription
data-request-mictrue/falseRequest microphone access
data-force-mictrue/falseRequire microphone to proceed
data-fullscreennone/window/nativeFullscreen mode (default: none)
data-auto-initiatetrue/falseAuto-start without button click
data-require-nametrue/falseRequire name input (default: true)
data-hookCSS selectorApply .yom-active class to this element during stream
data-callbackFunction nameCustom validation before launch
data-langISO-639-1Language code
data-publisherstringPublisher name
data-coppa0/1COPPA compliance
data-genrestringGame genre

Complete Example

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Security-Policy"
        content="frame-src 'self' https://player.yom.net;">
  <style>
    .yom-toggle-visibility { transition: opacity 0.3s ease; }
  </style>
</head>
<body>
  <!-- Stream container -->
  <div class="yom-player-placeholder"
       data-yom-stream-id="demo"
       data-game-id="my-game"
       data-fullscreen="window"
       style="width: 100%; aspect-ratio: 16/9;">
  </div>

  <!-- Pre-stream UI (hidden when stream starts) -->
  <div class="yom-toggle-visibility" data-yom-stream-id="demo">
    <input class="yom-name-input" data-yom-stream-id="demo" placeholder="Enter your name">
    <button class="yom-launch-button" data-yom-stream-id="demo">Start Game</button>
  </div>

  <!-- In-stream controls (shown when stream starts) -->
  <div class="yom-toggle-visibility" data-yom-stream-id="demo" style="display: none;">
    <button onclick="window.postToPlayer('demo', 'SpawnBot', {amount: '1'})">Add Bot</button>
    <button onclick="window.postToPlayer('demo', 'ClearBot', {})">Clear Bots</button>
  </div>

  <script src="https://cdn.yom.net/yom-embed.js"></script>
</body>
</html>

What’s Next?