Youtube Live Broadcast API: liveStreamingNotEnabled
Asked Answered
C

1

7

Using the Youtube API via PHP to create events on users accounts who are authorised by OAuth. The code works for almost everybody except I have a couple of users who are getting the liveStreamingNotEnabled error as detailed here https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/insert. Obviously I assumed live streaming isn't enabled on their account so ask them if their account is verified, in good standing and if it shows as enabled on https://www.youtube.com/features which ususally points them in the right direction to getting it fixed.

However I have just been given access to a users account who is verified, in good standing and the YT features page shows his account as Live Streaming enabled as shown here enter image description here

Whats even more confusing is that I can create and start a live broadcast manually from inside his account.

Any ideas what could be causing this? Driving me crazy!

Chose answered 9/11, 2016 at 12:13 Comment(12)
Looks like he is using a brand account which, while I can't find any documentation to support the theory, I think may be messing with thingsChose
Did you find any solution to this?Blinny
IIR it can take a little while before the liveStreamingNotEnabled is picked up after it has been enabled.Mutism
@DaImTo like 3 or 4 years? Yeah, makes sense. Because I've got it enabled way over 3 years ago and streamed at that time too and yesterday as well. Of course, waiting 4 years won't matter...Jacey
I want everyone to know that this issue is happening on accounts that have enabled live streaming years ago and continuously stream with no copyright strikes. There’s no way the API can possibly think that the authorized users don’t have live streaming enabled. This is absolutely ridiculous. And we’re also talking about an intended behavior for the API. It must be resolved. @DaImTo please, read it thoroughly and give me a reasonable answer as to why the API returns this error. PLUS, when you try it out on YouTube’s API page, the test WORKS with the exact same code.Jacey
The API doesn't lie if it says its not enable its not enabled are you sure your logging in under the same channel? I understand that you are frustrated. but this is a free API. "It must be resolved" will not come into play on something thats free.Mutism
@DaImTo okay, point taken. However, you know what I mean. The help link itself takes you to page where YouTube itself says that the service IS enabled. So why would the API say it’s not when it clearly is? Even after 3 or 4 years of being enabled. Have you checked if the API isn’t lying? Are you 100% sure that the API doesn’t have a bug?Jacey
Also, yes, definitely the same channel. In any case, I have tried other channels as well (associated with the same account) but same problem. We are now trying out with another account which was enabled just now, so we're gonna give it some time for the API to pick up the changes and see what we get. So far, same problem.Jacey
@DaImTo I thought you'd find this information useful: in the past few days, my team and I have made lots of tests and found out that the PHP client library returns this liveStreamingNotEnabled error but the cURL approach doesn't. We're taking a wild guess that there's something wrong with the PHP client library. However, I checked every file in the library for clues and found nothing. It's a weird behavior. No access token was missing, no scope was omitted, everything was written just as is in the YouTube code samples page. In conclusion, the answer to this question might be along those lines.Jacey
Have you posted an issue over there? github.com/googleapis/google-api-php-client/issuesMutism
@DaImTo I have not, I admittedly do not often use GitHub. I'll post it now.Jacey
@DaImTo I submitted the issue: Issue #1851Jacey
J
1

This is not necessarily an answer to the question but rather a workaround. However, I hope people find it useful when dealing with this problem until a real answer or solution is found.

Seems like the PHP client library has some kind of bug and it throws this liveStreamingNotEnabled error we are talking about. However, it works perfectly when using the cURL approach like this:

$endpoint = 'https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet,contentDetails,status&broadcastType=all&mine=true&key=[YOUR_API_KEY]';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Accept: application/json',
    'Authorization: Bearer '.$_SESSION['access_token'] // make sure this exists
]);
$output = curl_exec($ch);
curl_close($ch);
$res = json_decode($output, true);
if(isset($res['error'])){
    throw new Google_Exception($res['error']['message']);
}

So, I hope it really is just a simple bug in the library that just has not been addressed in a really long time. I posted the issue on GitHub.

Jacey answered 15/6, 2020 at 14:41 Comment(1)
Please open a bug report on Google's issue tracker, then link back that page here too. This way, they have to at least acknowledge the problem.Exeunt

© 2022 - 2024 — McMap. All rights reserved.