Create Live Stream
Using create live stream API
A live stream create api will help you to connect your RTMP stream to videosdk.live.
- cURL
- NodeJS/JS
- Python
- Ruby
- RESULT
curl -L -X POST 'https://api.videosdk.live/v1/livestreams' \
--header 'Authorization: `jwt token goes here`' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Nickname for livestream",
"record": true,
"restream": [
{
"url": "rtmp://x.rtmp.youtube.com/live2",
"streamKey": "0tjp-h6a2-8c9d-vusv-01uu"
}
]
}'
var fetch = require("node-fetch");
const url = "https://api.videosdk.live/v1/livestreams";
var options = {
method: "POST",
headers: {
Authorization: `${YOUR_JWT_TOKEN}`,
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Nickname for livestream", record: true
restream: [
{
"url": "rtmp://x.rtmp.youtube.com/live2",
"streamKey": "0tjp-h6a2-8c9d-vusv-01uu"
}
]
}),
};
fetch(url, options)
.then((res) => res.json())
.then((json) => console.log(json))
.catch((err) => console.error("error:" + err));
import requests
url = "https://api.videosdk.live/v1/livestreams"
payload = {
"name": "Nickname for livestream", "record": True,
"restream": [
{
"url": "rtmp://x.rtmp.youtube.com/live2",
"streamKey": "0tjp-h6a2-8c9d-vusv-01uu"
}
]
}
headers = {
"Authorization": `${YOUR_JWT_TOKEN}`,
"Accept": "application/json",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.videosdk.live/v1/livestreams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request["Authorization"] = `${YOUR_JWT_TOKEN}`
request.body = "{\"record\":false,\"name\":\"Nickname for livestream\",\"restream\": [ { \"url\": \"rtmp://x.rtmp.youtube.com/live2\", \"streamKey\": \"0tjp-h6a2-8c9d-vusv-01uu\" } ]}"
response = http.request(request)
puts response.read_body
{
"record": false,
"userId": "607adacdaeba2c4d217d5fea443d",
"name": "videosdk",
"streamKey": "e83fb175-5606-4ee5-b960-aacfce300ba6",
"upstreamUrl": "rtmp://live.videosdk.live/live/e83fb175-5606-4ee5-b960-aacfce300ba6",
"downstreamUrl": "https://live.videosdk.live/live/e83fb175-5606-4ee5-b960-aacfce300ba6/index.m3u8",
"recordingUrl": "https://live.videosdk.live/live/e83fb175-5606-4ee5-b960-aacfce300ba6/storage/index.m3u8",
"restream": [
{
"_id": "60e2fed0135c9810f490f3b6",
"url": "rtmp://x.rtmp.youtube.com/live2",
"streamKey": "0tjp-h6a2-8c9d-vusv-01uu"
}
],
"createdAt": "2021-07-05T12:43:52.921Z",
"updatedAt": "2021-07-05T12:45:04.379Z",
"user": {
"name": "Demo user 01",
"id": "607adacdaeba2c4d217d5fea"
},
"id": "60e2fe88135c9810f490f3b4"
}
Request
__requestrequired
object
namerequired
string
recordoptional
boolean
restream
Array<object>
Restream video stream on other social media or other live streaming serviceurlrequired
string
streamKeyrequired
string
Properties
Response
__response
object
record
boolean
id
string
name
string
streamKey
string
upstreamUrl
string
downstreamUrl
string
recordingUrl
string
restream
Array<object>
url
string
streamKey
string
id
string
createdAt
date
updatedAt
date
Properties