#YouTube Live Streaming API

1 messages · Page 1 of 1 (latest)

lone fjord
#

I'm trying to create a program in Java to live stream to YouTube.

Using these deps:

'com.google.oauth-client:google-oauth-client-jetty:1.35.0'
'com.google.api-client:google-api-client:1.15'
'com.google.oauth-client:google-oauth-client:1.35.0'
'com.google.apis:google-api-services-youtube:v3-rev222-1.25.0'

Here's my code: https://gist.github.com/tj-wazei/2545ee160e1e545bdb94c204c4c1889f

This is my error:

{
  "code": 403,
  "errors": [
    {
      "domain": "youtube.liveBroadcast",
      "message": "Invalid transition",
      "reason": "invalidTransition",
      "extendedHelp": "https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/transition#params"
    }
  ],
  "message": "Invalid transition"
}```
weary skyBOT
#

<@&987246964494204979> please have a look, thanks.

lone fjord
#

If it makes any difference, I'm creating the broadcast first manually within YouTube and hard coding the broadcast id in. I've hit my daily rate limit on how many broadcasts I can create via the API

halcyon rampart
#

can you pls rename the gist to have a .java extension peepo_heart

lone fjord
#

Done, forgot myb ;p

#

they have poor docs and the lib itself isn't documented. params on the methods are like var1, var2... doesn't help, I've had to do a lot of googling and broken gpt to figure it out lol

#

trying to reference code in other languages etc., to piece it together and i'm stuck here atm

#

The flow is weird too:

  • Auth
  • Create broadcast
  • Create stream
  • Bind Stream to broadcast
  • Set broadcast to test
  • Set broadcast to active
halcyon rampart
#

at what stage are you getting that response?

lone fjord
#

the very end

halcyon rampart
#

ok yea

lone fjord
#
LiveBroadcast liveBroadcast =
                youtube.liveBroadcasts()
                        .transition(broadcastId, part, "status")
                        .setBroadcastStatus(BroadcastStatus.TESTING.getStatus())
                        .setId(broadcastId)
                        .execute();

#

this changes the broadcast status to testing

#

at the moment it's in a "ready" status

#

after testing, i need to set it to "active" which means live

#

the part parameter, is what information you want the API to send back (who would have thought)

#

I think this is the issue

halcyon rampart
#

ok yeah

#

too much testing

#

lol

lone fjord
#

i mean i am just running it, getting exception, fix it, continue onto next exception 😄

#

there must be a developer playground?

halcyon rampart
#

on the website itself

#

but not in java

#

just some interface

#

and hard to test livestreaming from a playground

lone fjord
#

they suck

halcyon rampart
#

why not splitting it into a different pr

#

and ignore it for now?

lone fjord
#

yeah i can - its just nobody reviewing rn anyway lol

weary skyBOT
#

@lone fjord

Your question has been closed due to inactivity.

If it was not resolved yet, feel free to just post a message below
to reopen it, or create a new thread.

Note that usually the reason for nobody calling back is that your
question may have been not well asked and hence no one felt confident
enough answering.

When you reopen the thread, try to use your time to improve the quality
of the question by elaborating, providing details, context, all relevant code
snippets, any errors you are getting, concrete examples and perhaps also some
screenshots. Share your attempt, explain the expected results and compare
them to the current results.

Also try to make the information easily accessible by sharing code
or assignment descriptions directly on Discord, not behind a link or
PDF-file; provide some guidance for long code snippets and ensure
the code is well formatted and has syntax highlighting. Kindly read through
https://stackoverflow.com/help/how-to-ask for more.

With enough info, someone knows the answer for sure 👍

lone fjord
#

Todays quota refreshed woo, I can test this again and the error is back