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
- Read the Introduction — Understand what StreamLayer delivers and how the SDK architecture works.
- Follow the Integration Guide — Step-by-step setup: npm install, SDK API Key, initialization, and component placement.
- Try a Test Integration — Validate your setup with ads and in-play game features.
- Explore Sample Integrations — Fully functional reference projects.
Module Formats
@streamlayer/react ships as a dual-format package — ESM and CJS:
| Format | Condition | Target | Path |
|---|---|---|---|
| ESM | import / module | esnext | lib/es/*.js |
| CJS | default / require | ES2015 (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)
/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-polyfillNote: If your application already polyfills these APIs (e.g., via
@babel/preset-envwithuseBuiltIns), 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
| Feature | Component | Guide |
|---|---|---|
| Gamification UI | StreamLayerSDKReact | Gamification UI |
| Dynamic Advertising | StreamLayerSDKAdvertisement | Advertisement |
| Pause Ads | StreamLayerSDKExposedPauseAd | Pause Ads |
| Notifications | StreamLayerSDKNotification | Notifications |
| Gamification Points | StreamLayerSDKPoints | Points |
| Insight Unit | StreamLayerSDKInsight | Insight |
| Authentication | Auth Forwarding | Authentication |
| Deep Linking | Invite Links | Deep Links |
| Custom Themes | Dark Mode & Branding | Theme |
| Video Control | videoPlayerController | Video Controller |
| Flexible UI | useStreamLayerUI | UI Context |
| SDK Core API | useStreamLayer | SDK Context |
System Requirements
- React 17+
- Node.js 18+
- npm or yarn
Support
- Email: [email protected]
- Slack: Integration partners can join our real-time support channel for engineering assistance.
- NPM Package: @streamlayer/react
Related
- Integration Guide — Complete SDK setup and configuration
- Test Integration: Ads + Games — Quick-start example with ads and games
- Sample Integrations — Fully functional reference projects
Updated about 1 month ago
