call := client.Video().Call("default", uuid.New().String())
// create the call where the WHIP will be sent to
response, err := call.GetOrCreate(ctx, &getstream.GetOrCreateCallRequest{})
// ensure we have a user for the host to send video via WHIP
client.UpdateUsers(ctx, &getstream.UpdateUsersRequest{
Users: map[string]getstream.UserRequest{
"whip-user": {
ID: "whip-user",
},
},
})
// create a token for the user sending video
streamKey, err := client.CreateToken("whip-user-id")
whipURL := response.Data.Call.Ingress.Whip.Address
fmt.Println("WHIP Server URL:", whipURL, "Bearer token:", streamKey)
WHIP
WHIP allows you to ingest media streams over WebRTC directly from OBS, ffmpeg and other video clients. It enables users to stream content with low latency.
Acquire credentials
To get the endpoint and token, you can use the following API:# WHIP URL is: response.call.whip.address
curl -X GET "https://video.stream-io-api.com/api/v2/video/call/livestream/${CALL_ID}?api_key=${API_KEY}" \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt"
Configuring OBS to use WHIP
To configure OBS to use WHIP, follow these steps:
- Open OBS and go to the “Stream” settings.
- Select “WHIP” Service.
- Enter Server URL obtained from SDK.
- Enter Bearer token obtained from SDK.
Limitations
Since WHIP is a relatively new protocol and does not provide server to client communication, there are some limitations to consider:
Simulcast and dynscale: While WHIP supports simulcast, most clients like OBS and ffmpeg do not yet support this feature. This limitation makes it impossible to switch between different resolutions on the subscriber side, meaning subscribers cannot always receive lower resolution streams when their network conditions require it.
Bandwidth control: Since WHIP does not provide server to client communication, it is not possible to control the bandwidth of the stream from the server side.
Reconnection: WHIP does not provide any mechanism for reestablishing the connection after a failure apart from the client repeating the whole process. So if the client reconnects it will be noticable for viewers.