Search code examples
phpyoutube-apiyoutube-data-apilive-streaming

Youtube api v3 - how set the stream key on new event


i have few stream keys created in youtube studio

enter image description here

With this example code, i can create a new event, but it always create a new stream (called New Stream in this example) ,I wonder, how can I set/force to use a previous stream key (cam1profile for example)

The working code is from enter link description here and just modified with my api keys


Solution

  • Ok I got the solution , just need to figure out the stream id I want to use and bind it to the broadcast

    $stream_id='ls7ACzSkqopkYLg2N3ghmQ15498827578945';
    $bindBroadcastResponse = $youtube->liveBroadcasts->bind(
        $broadcastsResponse['id'],'id,contentDetails',
            array(
                'streamId' => $stream_id,
            ));