Open enginebai opened 9 years ago
@iulukaya hi. I'm having trouble with the problem [forbidden 403, stream is inactive]. Everytime I try to start streaming, this error comes up and cannot stream any longer. I wish you could help me with the problem
Recently, the broadcast received the streaming normally, and I call the code
Transition transitionRequest = youtube.liveBroadcasts().transition(
"live", broadcastId, "status");
transitionRequest.execute();
and I always get this error 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"
}
Is something wrong??
@enginebai Oh! How did you solved out the problem [stream is inactive]? I'm still having problem... please tell me how you did it!!
@JohnLeekk Have you uploaded your stream to youtube successfully?? I solved this problem after uploading the stream successfully.
But I encountered another problem when trying to start the broadcast, the transition API response always returns Invalid transition
status, my streaming status is good, I don't know what the problem is.
@enginebai Yes. I uploaded stream successfully. I can not find any Exceptions during creating Broadcast. However when I try to change status to "Live", [stream is inactive] error occurs. Also I have same problem [Invalid transition] when I change status to "complete". I could not figure out what is wrong......
@JohnLeekk Have you seen this screen? Is your streaming status good? If not, you should fix the problem first.
@enginebai Yeah! I've checked the stream status and it's good. So your app normally streams video from smartphone? A week ago changing API key on Developer Console made me stream well. try it!
{ "code": 403, "errors": [ { "domain": "youtube.liveBroadcast", "message": "Stream is inactive", "reason": "errorStreamInactive", "extendedHelp": "https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/transition" } ], "message": "Stream is inactive" }
getting error, how to resolve this??
@app24hk You can go to the youtube creator console and check the streaming status. Make sure that status is good so that you can call transition api successfully.
@enginebai, I'm not able to find streaming status option in creator studio. Can you help me out in detail?
Here's my solution.
If you guys are using Youtube WatchMe sample, in YoutubeAPI > startEvent
method, set the Thread.sleep()
a little bit longer. The default value is 10000 in ms, I set mine to 20000.
...
public static void startEvent(YouTube youtube, String broadcastID) throws IOException{
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
Log.e(MainActivity.APP_NAME, "", e);
}
YouTube.LiveBroadcasts.Transition transitionRequest = youtube.liveBroadcasts()
.transition("live", broadcastID, "status");
transitionRequest.execute();
}
...
Well, I guess the idea is to wait until StreamingActivity loaded and Ffmpeg starts tramitting data to YouTube so that the stream status changed to 'good' or 'ok' as long as not 'no data', and then we can do the transition request. Hope it helps :)
Yeap, @mcxycross provides a work-around solution. It works at all, I think that the problem is thread issue.
To live stream on mobile, your channel will need to have at least 1,000 subscribers. Note that this eligibility threshold does not apply to other live streaming tools. Creators who have less than 1,000 subscribers can still live stream through a computer and webcam. https://support.google.com/youtube/answer/2853834?hl=en
Problem: "message": "Stream is inactive" means, you call the below code before connecting the RTMP server.
Transition transitionRequest = youtube.liveBroadcasts().transition("live", broadcastId, "status"); transitionRequest.execute();
Solution: You have to call the above code after connecting the stream server. Another way you can do it is by enabling autostart when creating a broadcast event. When you enable auto-start, you do not need to call the above code. Here is the sample code for enabling auto-start.
LiveBroadcastContentDetails contentDetails = new LiveBroadcastContentDetails(); contentDetails.set("enableAutoStart", true);
After creating a broadcast and start the streaming, I always get ths error caused by calling
YouTubeApi.startEvent()
.How can I fix this problem??