Kruiz-Control icon indicating copy to clipboard operation
Kruiz-Control copied to clipboard

Suggestion: Ad Break Trigger

Open TheTaraStark opened this issue 1 year ago • 1 comments

New trigger for when midroll ads begin. Twitch added it to their API in October and it's out of beta. Documentation here

OnTWAdBreak Could be used to trigger chat messages (prompts to subscribe, get prime, thank viewers for supporting with ads, etc), make countdown timers visible on stream to show how far stream is into ad break, etc

<duration> would probably be the most useful parameter here (change chat messages or trigger different timers), though <is_automatic> could also be neat for conditional "Streamer is taking a break now so you don't miss the action!" or "Streamer had no control, ads have to run sometime" messages, etc

TheTaraStark avatar Mar 21 '24 20:03 TheTaraStark

Just discovered "Get Ad Schedule" was added to Twitch's API at some point. https://dev.twitch.tv/docs/api/reference/#get-ad-schedule

These could be strung together to trigger actions before ads run. I'm envisioning situations where a warning allows viewers to beg for a snooze, where viewers choose to sub before ads hit, etc.

TheTaraStark avatar Apr 08 '24 23:04 TheTaraStark

I think this would a great feature to implement, I think to make this work you could parse the output into JSON format from the Get Ad Schedule, and it'll be this file that gets updated when it the event is triggered which will update on the overlays and/or display a notification on chat or on screen.

{
  "OnTwAdBreak": {
  "AdSchedule": "2023-08-01T23:08:18+00:00",
  "AdMsg": [
    {
    "message": "",
    "comments": "Fill Ad message above this line in the double-quotes",
    },
  ],
  "AdDuration": "<n seconds>",
    "data": [
    {
      "next_ad_at" : "2023-08-01T23:08:18+00:00",
      "last_ad_at" : "2023-08-01T23:08:18+00:00",
      "duration" : "60",
      "preroll_free_time" : "90",
      "snooze_count" : 1,
      "snooze_refresh_at" : "2023-08-01T23:08:18+00:00",
    },
  ],
  "broadcaster_id": "",
  "comments": "Broadcaster's numerical ID num, user_id must also match broadcaster_id auth token",
  "length": "60",
  "CommandExec": "OnTWAdBreak $AdMsg"
  },
}

alkaris2 avatar Jul 22 '24 17:07 alkaris2

Added in the latest release, v2.0.5.

Kruiser8 avatar Jul 24 '24 04:07 Kruiser8