Video Power-ups: Custom Power-ups, ?parts=video overlay, new redeems editor

- Custom Power-ups (bits) are redeem triggers: channel.custom_power_up_redemption.add
  -> redeems.handle('custom_power_up', ...) with the bits amount; listed live from
  Helix /bits/custom_power_ups on the Redeems page; labels/replay in Recent activity.
- Variations can show a video (reward_variations.video): style 'video' plays only on
  the opt-in ?parts=video overlay (public/alerts/video.js), full-screen, one at a time,
  with a yellow camcorder box ("TRIGGERED <name>", viewer, bits, POWER-UP) in the alert
  corner. Any source size; 2560x1440 like HUDFX gives sharper video.
- Redeems page rewritten as one editor: Display (Cassette / Sound only / Video),
  volume slider, sticker thumbnails, live % chances, one Save button + Ctrl+S
  (POST /redeems/save), tests/add/delete save first, unsaved edits kept as a browser
  draft with an inline restore bar (no dialogs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-11-22 16:10:56 +02:00
parent 19a0965eb2
commit b3caac7a31
11 changed files with 512 additions and 135 deletions

View file

@ -124,6 +124,8 @@ async function subscribeAll(sessionId) {
{ type: 'channel.follow', version: '2', condition: { broadcaster_user_id: b, moderator_user_id: b } },
// cheers AND bits Power-ups (message effect, celebration, gigantify); replaces channel.cheer
{ type: 'channel.bits.use', version: '1', condition: { broadcaster_user_id: b } },
// Custom Power-ups (bits, made on Twitch): redeem variations, e.g. full-screen videos
{ type: 'channel.custom_power_up_redemption.add', version: '1', condition: { broadcaster_user_id: b } },
// subs, resubs, gifts, community gifts, raids, with Prime/multi-month/recipient/message details
{ type: 'channel.chat.notification', version: '1', condition: { broadcaster_user_id: b, user_id: b } },
{ type: 'channel.channel_points_custom_reward_redemption.add', version: '1', condition: { broadcaster_user_id: b } },
@ -207,6 +209,12 @@ function handleNotification(payload) {
if (alert) alerts.send(alert, event);
break;
}
case 'channel.custom_power_up_redemption.add': {
const p = event.custom_power_up || {};
if (p.id) redeems.handle('custom_power_up', p.id, p.title || 'Custom Power-up',
{ user: event.user_name || event.user_login, input: event.user_input || null, bits: p.bits ?? null }, event);
break;
}
case 'channel.raid':
if (event.from_broadcaster_user_id === broadcasterId) alerts.raidHappened(event).catch(e => console.error('[alerts] raid out:', e.message));
break;