How can I change the stream my event uses via the YouTube live api?

前端 未结 1 1373
孤街浪徒
孤街浪徒 2021-01-28 22:10

So I have been looking for a way to get the 16 digit stream name from YouTube and i have finally found out how which is via this line of code ->

streamName = ret         


        
1条回答
  •  天涯浪人
    2021-01-28 22:37

    Live broadcast is associated with a stream using a liveBroadcasts/bind method.

    In terms of Java API it would look something like this:

    YouTube yt = ...         // your reference to YouTube
    String broadcastId = ... // your broadcast Id
    
    String newStreamId = ... // identifier of stream you want to bind
    String apiKEy = ...      // your API key
    
    // you can define other response parts if you want more or don't want some of these
    String responseParts = "id,status,contentDetails.boundStreamId";
    
    yt.liveBroadcasts().bind(broadcastId, responseParts)
        .setApiKey(apiKey)
        .setStreamId(streamId)
        // other data you might want in request
        .execute()
    

    API references:

    • YouTube
    • LiveBroadcasts.bind method
    • LiveBroadcasts.Bind request
    • Available response fields

    0 讨论(0)
提交回复
热议问题