Is there a way to flip a game extension on or off based on the currently played game?
I’m guessing that manually is not the answer you are looking for… This is another area where we will end up doing more going forward; although I cannot and will not make any time commitments
Rest assured, it is something that we are aware of, and want to improve on!
Pretty sure you can show/hide the UI based on the game. You can get the currently played game with the onContext
callback from the twitch helper js.
window.Twitch.ext.onContext(function (context, contextFields) {
//console.log(context.game);
});
Then you can hide the UI with display: none
or however you choose.
From the testing i have done so far on our extension onContext context.game does not get updated in real time. So if a broadcaster changes game the viewer extension will not see the updated until the viewer refreshes the page.
@rbartlet Is this correct?
Ah yeah, the fact that it doesn’t update in real time is a bummer. My extension also relies on the current game, so let’s hope they make it update in real time soon.
Ah yes. In our case we may be able to disable it by emitting a signal to our EBS when the game session ends, but a built-in context update on game change would be awesome.
I couple this with polling of the Twitch API to get game/title too.
https://api.twitch.tv/kraken/channels/[chan ID]/
Either way right now, since we can ONLY have one video overlay, streamers are switching game specific ones in and out as they need to