Kruiser8 / Kruiz-Control

Kruiz Control enables a pseudo code approach to manage and automatically handle Twitch Channel Points, Twitch Chat, OBS or SLOBS, and StreamElements or Streamlabs alerts.
Other
233 stars 32 forks source link

Suggestion: Ad Break Trigger #76

Closed TheTaraStark closed 3 months ago

TheTaraStark commented 7 months ago

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 commented 7 months ago

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.

alkaris2 commented 3 months ago

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"
  },
}
Kruiser8 commented 3 months ago

Added in the latest release, v2.0.5.