Live Stream

Host your events virtually and see community interaction as it happens

Live streams and playback videos information are stored in Amity.Stream. To start working with stream, first, the app needs to initialize the repository. To create a new SDK instance with your API key, refer to the Initialization section.

There is a limitation for the maximum concurrent live events. Please feel free to reach out to us at community.amity.co with your use-case and we will determine if the current limit can be raised.

Viewing a live stream

Retrieve a stream object

Each stream object has a unique identifier. To retrieve a single stream object. The stream object contains essential data such as title, description, streamerUrl, watcherUrl, etc

Stream Status

Stream consists of many states. It can change from one state to another, depending on events and actions.

Amity.StreamStatus.<STATUS> represents a stream status. The following enum cases describe all the possible statuses of a stream.

  • IDLE indicates "a stream that has generated but no actions have been taken."

  • LIVE indicates "a stream is currently being broadcasted."

  • ENDED indicates "a stream has ended broadcasting and in the process of transforming to a recorded stream."

  • RECORDED indicates "a stream has ended broadcasting and has been transformed to a recorded stream."

Retrieve a stream collection

You can query a list of stream by calling queryStream.

Playing a live stream

To play a live stream, currently FLV, RTMP and HLS protocol are supported by using watcherUrl inside the stream object.

Play a recorded stream

To play a recorded stream, currently FLV, MP4 and M3U8 protocol are supported by using recordings inside the stream object.

Create a stream object

Note that the TypeScript SDK does not support broadcasting a live stream directly. Instead, it allows the creation of a stream object. You can then retrieve the streaming URL from this object and implement it with a third-party library or streaming tools like OBS.

Stop live stream session

To stop broadcasting a live stream, you can use the dedicated stop function provided by the SDK. This function will explicitly end the ongoing live stream and change its status to 'ENDED' Using this function is crucial for effectively managing your live streams and ensuring that they transition properly to their recorded state after broadcasting. Here's how you can use the function:

Delete live stream

To delete a stream, you will need the ID of the stream that you want to delete. The function will return true if successfully deleted, otherwise, it will throw an error.

Last updated