Skip to main content
Version: 3.x.x

WHIP/WHEP for Interactive Live Streaming

Overview

WHIP (WebRTC-HTTP Ingestion Protocol) and WHEP (WebRTC-HTTP Egress Protocol) are standardized protocols that enable WebRTC-based streaming over HTTP. These protocols simplify the integration of WebRTC streaming into your applications by providing RESTful HTTP endpoints for media ingestion and egress.

  • WHIP (WebRTC-HTTP Ingestion Protocol) allows you to send (ingest) WebRTC media streams to a VideoSDK meeting.

  • WHEP (WebRTC-HTTP Egress Protocol) allows you to receive (egress) WebRTC media streams from a VideoSDK meeting.

Use Cases

  1. OBS Studio Integration: Stream professional broadcasts from OBS Studio directly into VideoSDK meetings without custom WebRTC implementations
  2. Mobile Broadcasting: Stream from mobile apps using native WebRTC SDKs
  3. Hardware Encoders: Integrate hardware encoders that support WebRTC
  4. IoT Devices: Stream from IoT devices with WebRTC capabilities
  5. Multi-Source Aggregation: Combine multiple streams into a single VideoSDK meeting

Real-time Example: Connecting OBS Studio to VideoSDK

This example demonstrates how to stream from OBS Studio into a VideoSDK meeting using WHIP.

Prerequisites

  1. OBS Studio: Download and install OBS Studio
  2. VideoSDK Token: Generate a token from the VideoSDK Dashboard
  3. Room ID: Create or use an existing VideoSDK room

Step-by-Step Guide

Step 1: Configure OBS Studio

  1. Open OBS Studio

  2. Navigate to SettingsStream

  3. Select Custom as the service type

  4. In the Server field, enter:

    https://api.videosdk.live/v2/whip?roomId=YOUR_ROOM_ID&participantId=YOUR_PARTICIPANT_ID

    Replace:

    • YOUR_ROOM_ID with your actual VideoSDK room ID (e.g., zfww-680a-dzen)
    • YOUR_PARTICIPANT_ID with a custom participant ID (optional, will be auto-generated if not provided)
  5. In the Stream Key field, enter your VideoSDK token

OBS Studio WHIP Configuration

Step 2: Start Streaming

  1. Click Start Streaming in OBS Studio
  2. Your OBS stream will be ingested into the VideoSDK meeting
  3. The stream will appear as a participant in the VideoSDK room

Step 3: Verify the Connection

You can verify the connection by:

  1. Viewing the VideoSDK meeting using any VideoSDK client SDK
  2. Checking the participant list to see your WHIP stream participant
  3. Monitoring the stream quality and latency

OBS Studio and VideoSDK Meeting Side by Side

Endpoint Reference

The following endpoint is used to create a WHIP session for ingesting media streams into a VideoSDK meeting:

ParameterValue
MethodPOST
Endpointhttps://api.videosdk.live/v2/whip
HeadersAuthorization: <Your VideoSDK Token>
Content-Type: application/sdp
Query ParametersroomId (required): The VideoSDK room ID where the stream will be ingested
participantId (optional): Custom participant ID for the ingested stream. If not provided, a random participant ID will be generated
Request BodySDP offer (Session Description Protocol)
ResponseThe server returns an SDP answer in the response body and a Location header containing the session URL

What is an SDP Offer?

An SDP (Session Description Protocol) offer is a text-based description of the media capabilities that your WebRTC client wants to send or receive. It contains information about:

  • Media types (audio, video)
  • Codecs supported (e.g., Opus for audio, VP8/VP9/H264 for video)
  • Network information (IP addresses, ports)
  • ICE candidates for establishing the connection
  • Security parameters (DTLS fingerprints, ICE credentials)

When you create a WebRTC connection, your client generates an SDP offer describing what it can do. The server responds with an SDP answer that confirms the media parameters and establishes the connection.

Example SDP Offer:

v=0
o=- 1495799811084970 1495799811084970 IN IP4 0.0.0.0
s=-
t=0 0
a=msid-semantic: iot
a=group:BUNDLE audio
m=audio 9 UDP/TLS/RTP/SAVP 111
a=rtpmap:111 opus/48000/2
a=ssrc:6 cname:webrtc-opus
a=sendrecv
a=mid:audio
c=IN IP4 0.0.0.0
a=rtcp-mux
a=fingerprint:sha-256 72:7E:06:D6:D0:9C:2E:30:75:22:AD:01:75:D6:5B:2B:D7:FB:00:A2:CD:60:20:49:5B:B0:62:63:A6:5F:A7:B4
a=setup:passive
a=ice-ufrag:a3oo
a=ice-pwd:a3ooPQLUll7W9HOfLpF1GlLT
a=candidate:0 1 UDP 2129213695 10.144.33.135 59704 typ host
a=candidate:2 1 UDP 1693006079 115.246.27.117 59704 typ srflx raddr 0.0.0.0 rport 0

Key parts of this SDP offer:

  • m=audio 9 UDP/TLS/RTP/SAVP 111: Media line indicating audio support
  • a=rtpmap:111 opus/48000/2: Opus codec at 48kHz with 2 channels
  • a=fingerprint:sha-256 ...: DTLS fingerprint for secure connection
  • a=ice-ufrag and a=ice-pwd: ICE credentials for NAT traversal
  • a=candidate: Network candidates for establishing the connection

This SDP offer is automatically generated by your WebRTC client (like OBS Studio, a browser, or a mobile SDK) when you initiate a connection.

Example Request:

curl -X POST \
'https://api.videosdk.live/v2/whip?roomId=zfww-680a-dzen&participantId=whip-broadcaster' \
-H 'Authorization: YOUR_TOKEN' \
-H 'Content-Type: application/sdp' \
--data-binary @sdp-offer.txt

API Reference

For detailed API documentation, including request/response examples and all available endpoints, refer to:

Got a Question? Ask us on discord