Getting Started

Get started with the StreamLayer Web SDK. Install, configure, and integrate interactive features into your web application.

Welcome to the StreamLayer Web SDK documentation. This guide covers everything you need to integrate StreamLayer into your web application.

Start with your AI coding assistant

Connect your assistant to StreamLayer docs before changing code, then use this prompt. The connection lets it search the current guides and read the platform integration skill as it works.

Help me integrate StreamLayer into my existing browser React app using @streamlayer/react.
Use the streamlayer-docs MCP to search for and fetch the matching integration
guide and the streamlayer-web-integration skill page before editing code.
If search does not return the skill, read https://docs.streamlayer.io/docs/web-sdk-integration-skill
or ask me to copy that page into this session.
Cite the sources, confirm my SDK version and prerequisites, and make the smallest
documented change while preserving my player and app structure. Report missing
or conflicting guidance instead of guessing. Use placeholder keys in examples.
Finish with the checks run and the remaining platform/device validation steps.

Review the diff and follow the platform setup and testing guidance linked below.

Quick Start Path

  1. Read the Introduction — Understand what StreamLayer delivers and how the SDK architecture works.
  2. Follow the Integration Guide — Step-by-step setup: npm install, SDK API Key, initialization, and component placement.
  3. Try a Test Integration — Validate your setup with ads and in-play game features.
  4. Explore Sample Integrations — Fully functional reference projects.

Module Formats

@streamlayer/react ships as a dual-format package — ESM and CJS:

FormatConditionTargetPath
ESMimport / moduleesnextlib/es/*.js
CJSdefault / requireES2015 (Chrome 32+)lib/cjs/*.js
// ESM — esnext, modern syntax
import { StreamLayerProvider } from '@streamlayer/react'

// CJS — ES2015, transpiled with Babel for older environments
const { StreamLayerProvider } = require('@streamlayer/react')

Classic (/classic)

The /classic entry point is a mirror of the default exports — it resolves to the same files. It exists for backward compatibility with integrators already using /classic import paths:

// These are equivalent:
import { StreamLayerProvider } from '@streamlayer/react'
import { StreamLayerProvider } from '@streamlayer/react/classic'

Polyfills

The SDK provides an optional polyfills bundle for environments that lack modern browser APIs. Import it once at the top of your application entry point, before any SDK imports:

import '@streamlayer/react/polyfills'

The polyfill packages are listed as peer dependencies — install only the ones you need:

pnpm add core-js regenerator-runtime text-encoding-utf-8 \
  intersection-observer resize-observer-polyfill \
  web-streams-polyfill whatwg-fetch abortcontroller-polyfill

Note: If your application already polyfills these APIs (e.g., via @babel/preset-env with useBuiltIns), you may not need the polyfills bundle at all.

Styles

Import the SDK stylesheet in your application:

import '@streamlayer/react/style.css'

This is required for all visual SDK components to render correctly.

What You Can Build

FeatureComponentGuide
Gamification UIStreamLayerSDKReactGamification UI
Dynamic AdvertisingStreamLayerSDKAdvertisementAdvertisement
Host-Provided VAST AdsStreamLayerSDKAdvertisement (externalAdData)External VAST Ads
Pause AdsStreamLayerPauseAdPause Ads
NotificationsStreamLayerSDKNotificationNotifications
Gamification PointsStreamLayerSDKPointsPoints
Insight UnitStreamLayerSDKInsightInsight
AuthenticationAuth ForwardingAuthentication
Deep LinkingInvite LinksDeep Links
Custom ThemesDark Mode & BrandingTheme
Video ControlvideoPlayerControllerVideo Controller
Flexible UIuseStreamLayerUIUI Context
SDK Core APIuseStreamLayerSDK Context

System Requirements

  • React 17+
  • Node.js 18+
  • npm or yarn

Support


Related