I am trying to incorporate YouTube (videos and live streams) into our media site. I'm using, based on PHP, google/apiclient:^2.0
So far, I successfully accomplished authentication and authorization via OAuth and retrieving an list of uploaded on-demand videos already in the respective channel of my Google/Youtube user. Even managing offline access without recurring forced logins works.
Nonetheless, retrieving current live streams, and I must emphasize that the stream is active and can be watched in Youtube's dashboard, won't work. The live source is pushed to Youtube via Wowza 4.7, which works flawlessly.
This is the snippet responsible for fetching data:
public function livestreams()
{
try {
$this->_loadToken();
$this->setService(new \Google_Service_YouTube($this->getClient()));
$streamsResponse = $this->getService()->liveStreams->listLiveStreams('id,snippet', array(
'mine' => 'true',
));
} catch (\Exception $e) {
\Log::error($e->getMessage());
return [];
}
return $streamsResponse;
}
The result of this query:
Google_Service_YouTube_LiveStreamListResponse {#416 ▼
#collection_key: "items"
+etag: ""XXXXXXXX""
+eventId: null
#itemsType: "Google_Service_YouTube_LiveStream"
#itemsDataType: "array"
+kind: "youtube#liveStreamListResponse"
+nextPageToken: null
#pageInfoType: "Google_Service_YouTube_PageInfo"
#pageInfoDataType: ""
+prevPageToken: null
#tokenPaginationType: "Google_Service_YouTube_TokenPagination"
#tokenPaginationDataType: ""
+visitorId: null
#internal_gapi_mappings: []
#modelData: []
#processed: []
+"pageInfo": Google_Service_YouTube_PageInfo {#417 ▶}
+"items": []
}
So items
is empty, whereas I expect to find exactly one item, namely the currently active and watchable live stream I push to YouTube.
Is this a flaw in the API or is there a fundamental misunderstanding on my side?