Open sebastien-p opened 1 year ago
You cannot get it directly, but you can obtain the account ID and then fetch an endpoint that will show with platform that user is from:
window.addEventListener('onWidgetLoad', async (obj) => {
const accountId = obj.detail.channel.id
const accountFetch = await fetch(`https://api.streamelements.com/kappa/v2/channels/${accountId}`)
const account = await accountFetch.json()
console.log(account.provider) // twitch / youtube / trovo / etc
})
You cannot get it directly, but you can obtain the account ID and then fetch an endpoint that will show with platform that user is from:
window.addEventListener('onWidgetLoad', async (obj) => { const accountId = obj.detail.channel.id const accountFetch = await fetch(`https://api.streamelements.com/kappa/v2/channels/${accountId}`) const account = await accountFetch.json() console.log(account.provider) // twitch / youtube / trovo / etc })
Ok but I feel like sending an HTTP request to fetch an information that already is present in memory is a bad idea and this would introduce potential errors and latency for no reason.
Other than that, only on onEventReceived
, like a chat message, for example.
It will show in obj.detail.event.service
Other than that, only on
onEventReceived
, like a chat message, for example. It will show inobj.detail.event.service
Yes but I am implementing a solution for multi streaming so I need to know the source/provider for every event being onWidgetLoad
, onEventReceived
or onSessionUpdate
.
Unfortunately, there is no way. The only place you will have that information is either from onEventReceived
or fetching the endpoint.
Unfortunately, there is no way. The only place you will have that information is either from
onEventReceived
or fetching the endpoint.
Well the provider won’t change so we can assume having this info once in onWidgetLoad
would be enough. But what we have instead is an ID forcing us to send an HTTP request to exchange it for the provider name, I’m not sure how that would be useful. Why not just also expose the provider name alongside the ID since the parent frame already has it?
Why not just also expose the provider name alongside the ID since the parent frame already has it?
That's an excellent question that we will never know the answer. I also wouldn't expect that will be changed soon, given how hard is to reach SE devs or have good suggestions rolled out.
Why not just also expose the provider name alongside the ID since the parent frame already has it?
That's an excellent question that we will never know the answer. I also wouldn't expect that will be changed soon, given how hard is to reach SE devs or have good suggestions rolled out.
Fingers crossed 🤞
Hello
I would like to access the provider name (twitch, youtube, …) and found out that this information is stored in the AngularJS code of the parent frame but don’t seem to be exposed to the custom code one. Or maybe it is somehow? Only the provider ID seems to be available but I sadly can’t do much with it.
Thanks 😊