HLS Streaming

Introduction

HLS Streaming can be used to live stream your video conferencing apps in a cost effective way. The HLS stream will be a adaptive stream and have a latency of 8-10 seconds as compared to live.

Pre-requisites

  1. Management token
  1. Single click meeting url to directly enter a room

  2. 100ms SDK logs should be logged to console for the webapp url provided above. The SDK logs will be analysed to detect any room join failures and retries will be attemped to fix the same. If SDK logs are not enabled then the server will stop recording/streaming and return error (after fixed number of retries).

APIs

Start Streaming

POST
https://prod-in2.100ms.live/islb/api/v2/room/hls/start

This endpoint is used to start hls streaming

Headers

NameValueRequired
Content-type
application/jsonYes
Authorization
Bearer <management token>Yes

Body Parameters

NameTypeDescriptionRequired
room_id
stringThe room id of the room which we need to start streamingYes
variants
arrayList of objects of type variantsYes
recording
objectRecording configurationNo
variants
NameTypeDescriptionRequired
meeting_url
stringSingle click meeting url which we need to start streaming (see below for more details)Yes
meeting_url

This is a url which lands into the meeting directly. If you are using 100ms apps then this will be like - https://<domain>.app.100ms.live/preview/<room_id>/<role>?token=beam_recording. Example - https://myname.app.100ms.live/preview/61101349d0f56e684b608c08/beam?token=beam_recording

recording
NameTypeDescriptionRequired
single_file_per_layer
boolGet one recording file each for each hls layerNo
hls_vod
boolGet hls vod playlistNo

cURL

curl \ --location \ --request POST 'https://prod-in2.100ms.live/islb/api/v2/room/hls/start' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <management_token>' \ --data-raw '{ "room_id": <room_id>, "variants": [{"meeting_url": <meeting_url>}], "recording": {"single_file_per_layer": <true|false>,"hls_vod": <true|false>} }'

Stop Streaming

POST
https://prod-in2.100ms.live/islb/api/v2/room/hls/stop

This endpoint is used to stop hls streaming

Headers

NameValueRequired
Content-type
application/jsonYes
Authorization
Bearer <management token>Yes

Body Paramters

NameTypeDescriptionRequired
room_id
stringThe room id of the room for which we need to stop streamingYes

cURL

curl \ --location \ --request POST 'https://prod-in2.100ms.live/islb/api/v2/room/hls/stop' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <management_token>' \ --data-raw '{ "room_id": <room_id> }'

Get HLS URL

GET
https://prod-in2.100ms.live/islb/api/v2/room/hls/url

This endpoint is used to get the URL of a HLS stream

Headers

NameValueRequired
Authorization
Bearer <management token>Yes

Request Parameters

NameTypeDescriptionRequired
room_id
stringThe room id of the room for which we need to get hls urlYes

cURL

curl \ --location \ --request GET 'https://prod-in2.100ms.live/islb/api/v2/room/hls/url?room_id=<room_id>' \ --header 'Authorization: Bearer <management_token>'

Pause Recording

POST
https://prod-in2.100ms.live/islb/api/v2/room/hls/pause

This endpoint is used to pause hls recording. This has no effect on the live stream.

Headers

NameValueRequired
Content-type
application/jsonYes
Authorization
Bearer <management token>Yes

Body Paramters

NameTypeDescriptionRequired
room_id
stringThe room id of the room for which we need to pause recordingYes

cURL

curl \ --location \ --request POST 'https://prod-in2.100ms.live/islb/api/v2/room/hls/pause' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <management_token>' \ --data-raw '{ "room_id": <room_id> }'

Unpause Recording

POST
https://prod-in2.100ms.live/islb/api/v2/room/hls/unpause

This endpoint is used to unPause hls recording. This has no effect on the live stream.

Headers

NameValueRequired
Content-type
application/jsonYes
Authorization
Bearer <management token>Yes

Body Paramters

NameTypeDescriptionRequired
room_id
stringThe room id of the room for which we need to unpause recordingYes

cURL

curl \ --location \ --request POST 'https://prod-in2.100ms.live/islb/api/v2/room/hls/unpause' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <management_token>' \ --data-raw '{ "room_id": <room_id> }'

Recording upload destination

By default recordings will be uploaded to 100ms storage and a presigned URL for the same will be provided to customers via a webhook. The presigned url will expire in 72hours. Customers can also configure the recordings to be stored in their cloud storage. The configuration for the same can be provided when creating the room. If Pause/UnPause was triggered for recording, those intervals will be trimmed out and the edited recording will be uploaded to the storage.

Recording mp4 will be placed at - s3://<location>/<prefix>/hls/<room_id>/<start_date>/<epoch>/file-recording/Rec-<room_id>-<epoch>-<layer>.mp4. Example s3://test-bucket/test-prefix/hls/61101349d0f56e684b608c08/20210721/1626898422000/file-recording/Rec-61101349d0f56e684b608c08-1626898422000-0.mp4 Recording vod playlist will be placed at - s3://<location>/<prefix>/hls/<room_id>/<start_date>/<epoch>/hls-vod/Rec-<room_id>-<epoch>.zip. Example s3://test-bucket/test-prefix/hls/61101349d0f56e684b608c08/20210721/1626898422000/hls-vod/Rec-61101349d0f56e684b608c08-1626898422000.zip

Postman Collection