I tried to add an already active stream to a new broadcast, and can't get the broadcast started. The steps I took were.
- Created a new Broadcast.
curl --request POST \
"https://youtube.googleapis.com/youtube/v3/liveBroadcasts?part=snippet,contentDetails,status" \
--header "Authorization: Bearer XXX" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{'snippet':{'scheduledStartTime':'2021-05-18T17:28:00Z','title':'Tester','description':'descr'},'status':{'privacyStatus':'public','selfDeclaredMadeForKids':false},'contentDetails':{'enableAutoStart':true,'recordFromStart':true,'latencyPreference':'normal','enableAutoStop':false}}"
{
"kind": "youtube#liveBroadcast",
"etag": "gyv8ux9AiVL_NuZefS8SGXc3iZQ",
"id": "z--Lm8b1mU0",
"snippet": {
"publishedAt": "2021-05-18T17:27:39Z",
"channelId": "XXXXXXXXXXXXXXXX",
"title": "Tester",
"description": "descr",
...
},
"scheduledStartTime": "2021-05-18T17:28:00Z",
"isDefaultBroadcast": false,
"liveChatId": "KicKGFVDRUZXb015R0VtWFdrcDdkV1BMWWRXQRILei0tTG04YjFtVTA"
},
"status": {
"lifeCycleStatus": "created",
"privacyStatus": "public",
"recordingStatus": "notRecording",
"madeForKids": false,
"selfDeclaredMadeForKids": false
},
"contentDetails": {
"monitorStream": {
"enableMonitorStream": true,
"broadcastStreamDelayMs": 0,
...
},
"enableEmbed": false,
"enableDvr": true,
"enableContentEncryption": false,
"startWithSlate": false,
"recordFromStart": true,
"enableClosedCaptions": false,
"closedCaptionsType": "closedCaptionsDisabled",
"enableLowLatency": false,
"latencyPreference": "normal",
"projection": "rectangular",
"enableAutoStart": true,
"enableAutoStop": false
}
}
- Bind the already active stream to the Broadcast. I expected the enableAutoStart in the created broadcast to auto start the broadcast, though it did not.
curl --request POST "https://youtube.googleapis.com/youtube/v3/liveBroadcasts/bind?id=z--Lm8b1mU0&part=snippet,contentDetails,status&streamId=EFWoMyGEmXWkp7dWPLYdWA1615776388366728" --header "Authorization: Bearer XXXXXXXX" --header "Accept: application/json"
{
"kind": "youtube#liveBroadcast",
"etag": "L_Q87yK0gMxEM7VZ-aKHCTZ7n8g",
"id": "z--Lm8b1mU0",
"snippet": {
"publishedAt": "2021-05-18T17:27:39Z",
"channelId": "UCEFWoMyGEmXWkp7dWPLYdWA",
"title": "Tester",
"description": "descr",
},
"scheduledStartTime": "2021-05-18T17:28:00Z",
"isDefaultBroadcast": false,
"liveChatId": "KicKGFVDRUZXb015R0VtWFdrcDdkV1BMWWRXQRILei0tTG04YjFtVTA"
},
"status": {
"lifeCycleStatus": "ready",
"privacyStatus": "public",
"recordingStatus": "notRecording",
"madeForKids": false,
"selfDeclaredMadeForKids": false
},
"contentDetails": {
"boundStreamId": "EFWoMyGEmXWkp7dWPLYdWA1615776388366728",
"boundStreamLastUpdateTimeMs": "2021-05-18T16:58:04Z",
"monitorStream": {
"enableMonitorStream": true,
"broadcastStreamDelayMs": 0,
...
},
"enableEmbed": false,
"enableDvr": true,
"enableContentEncryption": false,
"startWithSlate": false,
"recordFromStart": true,
"enableClosedCaptions": false,
"closedCaptionsType": "closedCaptionsDisabled",
"enableLowLatency": false,
"latencyPreference": "normal",
"projection": "rectangular",
"enableAutoStart": true,
"enableAutoStop": false
}
}
- Attempted to transition the broadcast to live. I also tried transition to testing, which failed with the same error.
curl --request POST -H "Authorization: Bearer XXXXXX" "https://www.googleapis.com/youtube/v3/liveBroadcasts/transition?part=id,snippet,contentDetails,status&broadcastStatus=live&id=z--Lm8b1mU0"
{
"error": {
"code": 403,
"message": "Invalid transition",
"errors": [
{
"message": "Invalid transition",
"domain": "youtube.liveBroadcast",
"reason": "invalidTransition",
"extendedHelp": "https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/transition#params"
}
]
}
}
- Verified the stream is still active.
curl "https://youtube.googleapis.com/youtube/v3/liveStreams?part=snippet,cdn,contentDetails,status&id=EFWoMyGEmXWkp7dWPLYdWA1615776388366728" -H "Authorization: Bearer XXXXXXXXXXX" -H "Accept: application/json"
{
"kind": "youtube#liveStreamListResponse",
"etag": "ejyo1UhcC8AFCfiY-TxKo4yhwv0",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#liveStream",
"etag": "IZNA8olA5tx8tu2fGKPg4ws0YpM",
"id": "EFWoMyGEmXWkp7dWPLYdWA1615776388366728",
"snippet": {
"publishedAt": "2021-03-15T02:46:29Z",
"channelId": "XXXXXXXXXXXXXXXXXXXXXXXX",
"title": "Default stream key",
"description": "Description for default stream key",
"isDefaultStream": false
},
"cdn": {
"ingestionType": "rtmp",
"ingestionInfo": {
"streamName": "XXXX-XXXX-XXXX-XXXX-XXXX",
"ingestionAddress": "rtmp://a.rtmp.youtube.com/live2",
"backupIngestionAddress": "rtmp://b.rtmp.youtube.com/live2?backup=1",
"rtmpsIngestionAddress": "rtmps://a.rtmps.youtube.com/live2",
"rtmpsBackupIngestionAddress": "rtmps://b.rtmps.youtube.com/live2?backup=1"
},
"resolution": "variable",
"frameRate": "variable"
},
"status": {
"streamStatus": "active",
"healthStatus": {
"status": "good"
}
},
"contentDetails": {
...
"isReusable": true
}
}
]
}
Thoughts on how to make this work?