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.

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
Pause AdsStreamLayerSDKExposedPauseAdPause 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