I'm using the youtube data api v3 via the javascript library. The list livebroadcasts call (https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/list) gets broadcasts owned by the currently authenticated user (eg a user authenticated by oauth). I want to get a broadcast for a given channelid and then get its livechatid.
Is it possible to get the livechatid of a live broadcast not owned by the current authed user?
In my web app if there's a live broadcast for a given hardcoded channel id then I'll let people watch the broadcast via the embedded player and interact via a chat widget. This allows users to follow along with instruction while using the web app, and interact via chat.
Some initial investigation:
In the docs there're no parameters available to get around this problem in order to retrieve a livebroadcast's livechatid, which is required to list and insert on the livechatmessages resource. You can use the search api resource to get the video id of the currently live broadcast (see How to check if YouTube channel is streaming live), but then you cannot use the id
request parameter of the list livebroadcast
request to get to the livechatid).
It is possible to use the livechatmessages resource for a livechatid that is not owned by the current authed user (tried this by getting hold of the livechatid as the owner account, then authing as a second account and using the api explorer). So once I get the livechatid I can do what's needed
I could use a server-side call to get hold of the current livechatid. That seems like the only good answer at this point, but is a bunch of extra work.
There's also the possibility to embed the youtube chat iframe (see https://support.google.com/youtube/answer/2524549), but it appears that if you're not signed in then the chat frame will redirect the parent and not return to the site after sign in. Perhaps I can use the google client api to sign in, then load the iframe. This would be easier on front end work but sacrifices any customisability.