, $api_stream_url ServerURL/StreamKey
listLiveBroadcasts - .
listLiveStreams cdn - format, rtmp, streamName, ingestionAddress
try {
$broadcastsResponse = $youtube->liveBroadcasts->listLiveBroadcasts(
'id,snippet,contentDetails',
array(
'broadcastType' => 'persistent',
'mine' => 'true',
));
$boundStreamId = $broadcastsResponse['items']['0']['contentDetails']['boundStreamId'];
$streamsResponse = $youtube->liveStreams->listLiveStreams('id,snippet,cdn', array(
'id' => $boundStreamId
));
$ingestionInfo = $streamsResponse['items']['0']['cdn']['ingestionInfo'];
$broadcastsResponse = $streamsResponse['items']['0']['snippet'];
$api_stream_key = $ingestionInfo->streamName;
$api_stream_address = $ingestionInfo->ingestionAddress;
$api_stream_url = $api_stream_address."/".$api_stream_key;
return false;
} catch (Google_Service_Exception $e) {
$htmlBody = sprintf('<p>A service error occurred: <code>%s</code></p>',
htmlspecialchars($e->getMessage()));
} catch (Google_Exception $e) {
$htmlBody = sprintf('<p>An client error occurred: <code>%s</code></p>',
htmlspecialchars($e->getMessage()));
}