12

Right now I'm trying to figure out what i'm doing wrong when making transition of my YT broadcast to live.

So I make the request and get the following response:

{
  "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"
}

Of course i've read docs many times so I've monitored the LiveStream and was waiting for its "active" state (and my Broadcast has lifeCycleStatus="ready").

Error message doesn't explain real reason why cannot I do the transition.
And... of course I do not have access to logs of Youtube servers :)

What can you suggest?
How to find out where am I wrong?

So even if i've missed something, docs and error message do not help me to understand anything. So anyway it is kind of a "bug" for YT LiveStreaming API...

rshmelev
  • 588
  • 4
  • 12
  • Can you post the request you're making when you try to transition your live broadcast? Maybe one of your parameters is wrong. – JAL Jan 26 '16 at 01:46
  • unfortunately i was using tons of .jar's from google so all http requests were done by that .jars, so hidden from me. Probably there's an option to turn on verbose mode or something like this... anyway looks like i've found the solution so will post it here. – rshmelev Jan 29 '16 at 11:45

3 Answers3

18

So a bit unclear rule is:

  1. ensure you have broadcast and livestream created and ready.
    and ensure that broadcast lifecycle status is not COMPLETE, otherwise recreate broadcast ... so ensure that your broadcast lifecycle status is ready
  2. bind broadcast to livestream
  3. start publishing video to livestream
  4. wait for livestream status active
  5. transition to testing (yes, you have to do it instead of moving to live)
  6. wait for broadcast lifeCycleStatus to become testing
  7. transition to live
  8. wait for broadcast lifeCycleStatus to become live

You cannot skip testing and cannot transition from complete to testing or ready.

ravi404
  • 7,119
  • 4
  • 31
  • 40
rshmelev
  • 588
  • 4
  • 12
  • 1
    I am not sure that this is the case. The docs seem to point otherwise: https://developers.google.com/youtube/v3/live/docs/liveBroadcasts#contentDetails.monitorStream.enableMonitorStream – Ulises Giacoman Mar 30 '17 at 19:53
5

You can leave 4-7 steps if: the broadcast's monitor stream was disabled by setting the contentDetails.monitorStream.enableMonitorStream property to false when creating or updating that broadcast.

Maxim Firsoff
  • 2,038
  • 22
  • 28
2

I meet the same question, finally I found the problem. After post command transiton to testing, the lifeCycleStatus is: liveStarting, we need to wait lifeCycleStatus to become testing. So we should get broadcast status. here is my code:

liveStreamRequest = youtube.liveStreams()
                    .list("id,status")
                    .setId(liveBroadcast.getContentDetails()
                            .getBoundStreamId());
            LiveStreamListResponse returnedList = liveStreamRequest.execute();
            List<LiveStream> liveStreams = returnedList.getItems();
            if (liveStreams != null && liveStreams.size() > 0) {
                LiveStream liveStream = liveStreams.get(0);
                if (liveStream != null)
                    while (!liveStream.getStatus().getStreamStatus()
                            .equals("active")) {
                        Thread.sleep(1000);
                        returnedList = liveStreamRequest.execute();
                        liveStreams = returnedList.getItems();
                        liveStream = liveStreams.get(0);
                    }
            }

hope to help someone care about this problem!

lory
  • 41
  • 3