Welcome to the official Wowza Media Systems Web Real-time Communication (WebRTC) client examples. These examples cover four streaming scenarios:
- Publish — stream video and audio (or screen share) from a browser to Wowza Streaming Engine
- Play — play back a live WebRTC stream from Wowza Streaming Engine in a browser
WebRTC is an open source project to enable real-time communication of audio, video, and data in web browsers and native apps. WebRTC is designed for peer-to-peer connections but includes fallbacks in case direct connections fail. Encryption is mandatory for WebRTC streams, so you must host the examples on a web server using SSL encryption.
- Node.js v16 or later
- A running Wowza Streaming Engine instance with WebRTC enabled
You'll need to set up WebRTC for Wowza Streaming Engine to run the examples. For more information, see Set up WebRTC streaming with Wowza Streaming Engine.
- Updated engine WebRTC implementation — v2 targets the modernized WebRTC implementation introduced in Wowza Streaming Engine 4.11, which includes WHIP/WHEP support, Trickle ICE, HEVC and VP9 codec support, and signaling modernization.
- Configurable ICE servers — STUN and TURN servers can now be set from the UI. Multiple servers can be provided as a comma-separated list. Credentials for TURN servers (username and password) are also configurable.
- SecureToken support — Wowza Secure Token hash generation is now available in the React example. The token is computed client-side using the Web Crypto API (SHA-256) and sent with the publish/play request. See
v2/src/react-example/src/webrtc/SecureToken.jsfor usage notes. - Form validation — Required fields (application name and stream name) are validated before a connection is attempted, surfacing errors early instead of failing silently.
The examples are organized into two versions:
v2/src/react-example— React example with the latest features and fixesv2/src/react-example/src/components— React components for the publish, play, meeting, and composite examplescomposite— Components for compositing a WebRTC stream with multiple video and audio tracksmeeting— Components for publishing a WebRTC stream with multiple participantsplay— Components for playing back a WebRTC streampublish— Components for publishing a WebRTC stream
v2/src/react-example/src/hooksuseMediaStream.js— Custom hook for managing the active media stream ref
v2/src/react-example/src/webrtc— JavaScript files for managing the WebRTC setupSecureToken.js— Builds a secure token hashgetDevices.js,getUserMedia.js,getDisplayScreen.js— Media device helpersreplaceAudioTrack.js,replaceVideoTrack.js— Track replacement utilitiesstartPlay.js,stopPlay.js,startPublish.js,stopPublish.js— Stream lifecycle helpers
v2/src/react-example/src/utils— Utility functionsIceServersUtils.js— Validation and configuration helpers for STUN/TURN ICE serversValidationUtils.js— Form validation utilitiesCookieUtils.js— Cookie read/write helpers
v2/src/react-example/src/actions,v2/src/react-example/src/reducers— Redux state management
v1/src/jquery-example— Vanilla JavaScript/jQuery examplecssandimages— Assets used by the example HTML pageslib— JavaScript files for managing the WebRTC setupAvMenu.js— Controls the selected input for publishing and screen sharingSecureToken.js— Builds a secure token hashSettings.js— Creates a set of configuration settings and copy functionalitySoundMeter.js— Provides an audio meterWowzaMungeSDP.js— Utilities for modifying SDPWowzaPeerConnectionPlay.js— Manages the signaling process for playbackWowzaPeerConnectionPublish.js— Manages the signaling process for publishingWowzaWebRTCAPI.js— Core WebRTC API wrapperWowzaWebRTCPlay.js— Controls the playback stateWowzaWebRTCPublish.js— Controls the publishing state
dev-view-publish.html— Example page for publishing a WebRTC stream with video, audio, and screen sharedev-view-play.html— Example page for playing back a WebRTC streamdev-view-chat.html— Example page for a WebRTC chat sessionplay.jsandpublish.js— JavaScript files for controlling the WebRTC setup
v1/src/react-example— React example (Redux-based)src/components— React components for the publish, play, meeting, and composite examplessrc/webrtc— JavaScript files for managing the WebRTC setupsrc/actions,src/reducers— Redux state management
Note: If you're not running the examples from
localhost, an HTTPS connection is required for WebRTC to access local devices.
cd v2/src/react-example
npm install
npm startGo to localhost:3000 to view the example.
cd v1/src/react-example
npm install
npm startGo to localhost:3000 to view the example.
cd v1/src/jquery-example
npx serveGo to localhost:3000 to view the examples.
Wowza Media Systems™, LLC
Wowza Media Systems provides developers with a platform to create streaming applications and solutions. See the Wowza Developer Portal to learn more about our APIs and SDKs.
This code is distributed under the BSD 3-Clause License.
