HLS Streaming allows for scaling to millions of viewers in near real time. You can give a link of your webapp which will be converted to a HLS feed by our server and can be played across devices for consumption.
Behind the scenes, this will be achieved by having a bot join your room and stream what it sees and hears. Once the feed is ready, the server will give a url which can be played using any HLS Player.
Note that the media server serving the content in this case is owned by 100ms. If you're looking for a way to stream on YouTube, Twitch etc., please have a look at our RTMP streaming docs here.
To start HLS you'll need to pass in a meeting URL. The 100ms bot will open this URL to join your room, so it must allow access without any user level interaction. In the future it'll be possible to start HLS for multiple such URLs for the same room.
For this purpose the API supports taking in an array, although currently only the first element of the array will be used. To distinguish between multiple urls an additional field
metadata can be optionally passed. The
metadata are clubbed together to form what we'll call a
You can call
meeting.startHlsStreaming with a
HMSHLSConfig having an array of such variants.
Want to see how this works in a live project? Take a look at our advanced sample app.
The current status for the room is always reflected in the
Here are the relevant properties inside the
HMSRoom object which you can read to get the current hls streaming status of the room namely:
The object contains a boolean
running which lets you know if it's active on the room right now as well as list of active variants.
- hlsStreamingState an instance of
HMSHLSStreamingState, which looks like:
class HMSHLSStreamingState( val running : Boolean, val variants : List<HMSHLSVariant?>, )
This represents a livestream to one or more HLS urls in the container of
HMSHLSVariant. Which looks like:
class HMSHLSVariant( hlsStreamUrl: String?, meetingUrl: String?, metadata: String?, startedAt: double? )
The room status should be checked in following two places -
- In the
onJoin(room: HMSRoom)callback of
HMSUpdateListenerThe properties mentioned above will be on the
- In the
onRoomUpdate(type: HMSRoomUpdate, hmsRoom: HMSRoom)callback of
HMSRoomUpdatetype will be
- If you're using the dashboard webapp from 100ms, please make sure to use a role which doesn't have publish permissions for beam tile to not show up.
- If using your own webapp, do put in place retries for API calls like tokens etc. just in case any call fails. As human users we're used to reloading the page in these scenarios which is difficult to achieve in the automated case.
- Make sure to not disable the logs for the passed in meeting URL. This will allow for us to have more visibility into the room, refreshing the page if join doesn't happen within a time interval.