Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
broadcast = client.streaming.broadcasts.update(
broadcast_id=0,
)
print(broadcast.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
"github.com/G-Core/gcore-go/streaming"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
broadcast, err := client.Streaming.Broadcasts.Update(
context.TODO(),
0,
streaming.BroadcastUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", broadcast.ID)
}
curl --request PATCH \
--url https://api.gcore.com/streaming/broadcasts/{broadcast_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"broadcast": {
"name": "Broadcast",
"status": "live",
"share_url": "",
"custom_iframe_url": "",
"show_dvr_after_finish": true,
"ad_id": 1,
"player_id": 14,
"stream_ids": [
10
]
}
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
broadcast: {
name: 'Broadcast',
status: 'live',
share_url: '',
custom_iframe_url: '',
show_dvr_after_finish: true,
ad_id: 1,
player_id: 14,
stream_ids: [10]
}
})
};
fetch('https://api.gcore.com/streaming/broadcasts/{broadcast_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/streaming/broadcasts/{broadcast_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'broadcast' => [
'name' => 'Broadcast',
'status' => 'live',
'share_url' => '',
'custom_iframe_url' => '',
'show_dvr_after_finish' => true,
'ad_id' => 1,
'player_id' => 14,
'stream_ids' => [
10
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://api.gcore.com/streaming/broadcasts/{broadcast_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"broadcast\": {\n \"name\": \"Broadcast\",\n \"status\": \"live\",\n \"share_url\": \"\",\n \"custom_iframe_url\": \"\",\n \"show_dvr_after_finish\": true,\n \"ad_id\": 1,\n \"player_id\": 14,\n \"stream_ids\": [\n 10\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/streaming/broadcasts/{broadcast_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"broadcast\": {\n \"name\": \"Broadcast\",\n \"status\": \"live\",\n \"share_url\": \"\",\n \"custom_iframe_url\": \"\",\n \"show_dvr_after_finish\": true,\n \"ad_id\": 1,\n \"player_id\": 14,\n \"stream_ids\": [\n 10\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "Player",
"status": "paused",
"share_url": null,
"custom_iframe_url": null,
"show_dvr_after_finish": true,
"ad_id": null,
"player_id": null,
"stream_ids": [],
"id": 3111719,
"client_id": 102748,
"iframe_embed_code": "<iframe width=\"560\" height=\"315\" src=\"https://player.gvideo.co/broadcasts/2675_21606?no_low_latency\" frameborder=\"0\" allowfullscreen></iframe>",
"iframe_url": "https://player.gvideo.co/broadcasts/2675_21606?no_low_latency",
"pending_message": null,
"custom_messages": null,
"client_user_id": null,
"poster_thumb": null,
"poster": null
}This response has no body data.Broadcasts
Change broadcast
Updates broadcast settings
PATCH
/
streaming
/
broadcasts
/
{broadcast_id}
Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
broadcast = client.streaming.broadcasts.update(
broadcast_id=0,
)
print(broadcast.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
"github.com/G-Core/gcore-go/streaming"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
broadcast, err := client.Streaming.Broadcasts.Update(
context.TODO(),
0,
streaming.BroadcastUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", broadcast.ID)
}
curl --request PATCH \
--url https://api.gcore.com/streaming/broadcasts/{broadcast_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"broadcast": {
"name": "Broadcast",
"status": "live",
"share_url": "",
"custom_iframe_url": "",
"show_dvr_after_finish": true,
"ad_id": 1,
"player_id": 14,
"stream_ids": [
10
]
}
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
broadcast: {
name: 'Broadcast',
status: 'live',
share_url: '',
custom_iframe_url: '',
show_dvr_after_finish: true,
ad_id: 1,
player_id: 14,
stream_ids: [10]
}
})
};
fetch('https://api.gcore.com/streaming/broadcasts/{broadcast_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/streaming/broadcasts/{broadcast_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'broadcast' => [
'name' => 'Broadcast',
'status' => 'live',
'share_url' => '',
'custom_iframe_url' => '',
'show_dvr_after_finish' => true,
'ad_id' => 1,
'player_id' => 14,
'stream_ids' => [
10
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://api.gcore.com/streaming/broadcasts/{broadcast_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"broadcast\": {\n \"name\": \"Broadcast\",\n \"status\": \"live\",\n \"share_url\": \"\",\n \"custom_iframe_url\": \"\",\n \"show_dvr_after_finish\": true,\n \"ad_id\": 1,\n \"player_id\": 14,\n \"stream_ids\": [\n 10\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/streaming/broadcasts/{broadcast_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"broadcast\": {\n \"name\": \"Broadcast\",\n \"status\": \"live\",\n \"share_url\": \"\",\n \"custom_iframe_url\": \"\",\n \"show_dvr_after_finish\": true,\n \"ad_id\": 1,\n \"player_id\": 14,\n \"stream_ids\": [\n 10\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "Player",
"status": "paused",
"share_url": null,
"custom_iframe_url": null,
"show_dvr_after_finish": true,
"ad_id": null,
"player_id": null,
"stream_ids": [],
"id": 3111719,
"client_id": 102748,
"iframe_embed_code": "<iframe width=\"560\" height=\"315\" src=\"https://player.gvideo.co/broadcasts/2675_21606?no_low_latency\" frameborder=\"0\" allowfullscreen></iframe>",
"iframe_url": "https://player.gvideo.co/broadcasts/2675_21606?no_low_latency",
"pending_message": null,
"custom_messages": null,
"client_user_id": null,
"poster_thumb": null,
"poster": null
}This response has no body data.Authorizations
Path Parameters
Body
application/json
Response
Successful
Broadcast statuses:
Pending — default “Broadcast isn’t started yet” or custom message (see pending_message parameter) is shown, users don't see the live stream
Live — broadcast is live, and viewers can see it
Paused — “Broadcast is paused” message is shown, users don't see the live stream
Finished — “Broadcast is finished” message is shown, users don't see the live stream
The users' browsers start displaying the message/stream immediately after you change the broadcast status
Was this page helpful?