You can integrate your product to use the Video Streaming for unlimited video streaming and hosting services. In this guide, we’ll take you through the API and webhook operations involved in integrating with the Video Streaming.
Typically, your app presents users with an interface through which they can create and manage a stream. Each user action represents a request to an endpoint in the Video Streaming API and a webhook. The following diagram shows the typical high-level sequence of the operations grouped into stages:
You’ll need to have:
Your own video streaming interface created
A Gcore account with an active Streaming subscription
Having received a successful response from your app, the user can now publish the stream. Use the patch_streams_id method to activate the stream.Sample request payload:
Use the put_streams_id_stop_recording method to stop recordingThe response to this request contains information about the recorded video.Sample response payload:
Step 17. Send a webhook when the recorded video is partially processed
This indicates that one quality version of the video currently being processed is ready for the viewers to watch.The Video Streaming sends a webhook that contains “status”: “viewable” to your subscribed endpoint.Sample webhook payload:
Step 18. Send a webhook when the recorded video is completely processed
This indicates that all quality versions of the video are ready for viewers to watch.The Video Streaming sends a webhook that contains “status”: “ready” to your subscribed endpoint.Sample webhook payload:
The user can reuse the same stream for each broadcast. In this case, you don’t need to create a new one. Just update the stream using the patch_streams_id method with the appropriate transcoding region.Sample request payload:
You can also check for the stream status using the get_streams_id method. If the response contains “active”: false and the stream wasn’t manually interrupted, then you can call the patch_broadcasts_id method to transition the broadcast to “Paused” status.
Sample request payload:
Copy
Ask AI
{ "broadcast": { "status": "paused" }}
Sample response payload:
Copy
Ask AI
{ "id": 192470, "status": "paused", ...}
You can also stop the recording when the user has an interruption (even for a couple of minutes) during streaming. Your app can prompt the user to start the stream again. The stream recording will be broken into two files: data recorded up to the interruption and data recorded when the user renews streaming.
The Video Streaming can’t currently reconnect without interrupting the recording if the stream gets temporary disruption. But we plan to implement this in the future.
You can delete streams that have been inactive for some time and are associated with a deleted user account. To do this, use the delete_api_videos_id method.If the returned HTTP status code is 204, the request is successful.