Integration overview
A typical integration exposes a streaming interface to end users. Each user action maps to a Video Streaming API request and a corresponding webhook notification. The following diagram shows the high-level sequence grouped into stages:
- A Gcore account with an active Streaming subscription — the API endpoints are only accessible with an active subscription
- API authentication configured — all requests require a valid API key
- A webhook endpoint registered to receive event notifications — without it, stream and broadcast status transitions are not delivered to the integration
Basic operations
Stage 1. Setup
Create a stream
POST /streaming/streams) creates a stream object.- To prevent errors due to the quota for concurrent active sessions, set the
activeproperty tofalse. - Select the transcoding region based on the user’s location.
id and other necessary data for later steps.Create a broadcast
POST /streaming/broadcasts) creates a broadcast object.- Set the
stream_idsproperty to theidreturned from step 1 to bind the broadcast and stream together. - Set the
statusproperty topending.
id and other necessary data for later steps.Enable the stream
active to true makes the stream ready to receive ingest from the encoder. The Change live stream endpoint (PATCH /streaming/streams/{id}) activates the stream.Receive a webhook: stream started
"live": true to the subscribed endpoint.Stage 2. Test
The user tests the broadcast at this stage.Change the broadcast status to live
PATCH /streaming/broadcasts/{id}) updates the broadcast status to live.Receive a webhook: broadcast live
"status": "live" to the subscribed endpoint.Stage 3. Live
The stream and broadcast are now live and visible to the audience. Start recording if the session should be saved as a video.Start recording
PUT /streaming/streams/{id}/start_recording) begins recording.If the returned HTTP status code is 204, the request is successful.Receive a webhook: recording started
"recording": true to the subscribed endpoint.Stage 4. Stop
The user stops streaming at this stage.Stop recording
PUT /streaming/streams/{id}/stop_recording) stops recording.The response contains information about the recorded video.Receive a webhook: recording stopped
"recording": false to the subscribed endpoint.Receive a webhook: video processing started
"status": "pending" to the subscribed endpoint.Change broadcast status to finished
PATCH /streaming/broadcasts/{id}) updates the broadcast status to finished.Receive a webhook: broadcast finished
"status": "finished" to the subscribed endpoint.Disable the stream
Receive a webhook: stream ended
"live": true while the stream transitions to inactive. Wait for the subsequent webhook with "live": false to confirm that streaming has ended.The Video Streaming sends a webhook that contains "live": false to the subscribed endpoint.Delete the broadcast
DELETE /streaming/broadcasts/{id}) deletes the broadcast.If the returned HTTP status code is 204, the request is successful.Receive a webhook: video partially processed
"status": "viewable" to the subscribed endpoint.Receive a webhook: video fully processed
"status": "ready" to the subscribed endpoint.Get video information
GET /streaming/videos/{id}) retrieves detailed information about the recorded video.Special cases
Reuse of a stream
The same stream can be reused for multiple broadcasts — this avoids recreating push URLs and reconfiguring the encoder between sessions. Instead of creating a new stream, update the existing one with the Change live stream endpoint (PATCH /streaming/streams/{id}) to set the appropriate transcoding region.
Interruption during streaming
- The Video Streaming sends a webhook when the stream is briefly interrupted.
- The Get live stream endpoint (
GET /streaming/streams/{id}) returns the current stream state. If the response contains"active": falseand the stream was not manually interrupted, the Change broadcast endpoint (PATCH /streaming/broadcasts/{id}) transitions the broadcast topausedstatus.
- Stop recording (
PUT /streaming/streams/{id}/stop_recording) when an interruption occurs (even for a couple of minutes). After the stream resumes, the recording splits into two files: data recorded before the interruption and data recorded after the stream resumes.
Recording deletion
Recorded videos associated with a deleted user account can be removed using the Delete video endpoint (DELETE /streaming/videos/{id}).
If the returned HTTP status code is 204, the request is successful.