After a live stream ends, you can load content, such as interactive messages and live comments, from the live channel to display during the replay.
Message replay API
You can use this API to load content, such as live comments, from a live stream after it has ended.
You do not need to join the audience group to use this API. You only need to log on.
A single client can call this API up to 2 times per second. Calls that exceed this limit are rejected. Each call can return a maximum of 100 messages, and the maximum value for the PageSize parameter is 100. You can only retrieve messages of the live comment type.
To ensure stream performance and stability, avoid using this API during a live stream.
Typical scenario: Trigger events by timestamp during recorded playback
Combine the message replay API with player callbacks to trigger events, such as pop-ups, based on timestamps.
When the streamer client sends a custom message, record the event timestamp in your business database.
The player client calls the
listHistoryMessageAPI withbeginTimeandendTimeto query historical messages within a specific time range.The player client obtains the current playback progress through the
onTimeUpdatecallback of the player SDK.Compare the playback time with the timestamps of the queried messages, and trigger business logic, such as a pop-up, when they match.
beginTime and endTime are in seconds. A value of 0 means the earliest or latest time, respectively, consistent with the parameter descriptions in the existing code examples.