How to end Twitch stream using the live streaming API?

We’ve built functionality in our tool that allows users to run live streams on Twitch using its API. However, we haven’t been able to find a call or an option that allows us to stop the stream from our side.

How can we send a status to Twitch that tells it to stop the stream?

In cases where a user has enabled the “disconnect protection” for his/her account, the stream continues despite the fact that we have stopped sending the stream.

Can someone help me with the API call or any other parameter that needs to be passed to end a user’s stream on Twitch.?

There is no API endpoints for ending a users stream, as that’s entirely handled by the RTMP process itself.

At the end of an RTMP stream the NetStream deleteStream command should be sent, which will tell Twitch that it’s the end of the stream. Usually this is handled automatically by software like ffmpeg but if you’re running your own tool you may need to ensure you’re sending that, and that you’re gracefully shutting down whatever RTMP software you’re using.

If the stream just strops, without gracefully ending, then that’s what causes Twitch to use the disconnect protection as that is a disconnect, and no different from a loss of internet connection, or other failure that could cause a momentary outage.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.