Platform-Adaptive Widgets

Not every platform supports every feature. Use SBCanvas.platform to detect what’s available and adapt your widget accordingly.

Checking the Platform

SBCanvas.ready(() => {
  console.log(SBCanvas.platform.provider);    // 'kick', 'rumble', or 'blaze'
  console.log(SBCanvas.platform.channelName); // 'MyChannel'
  console.log(SBCanvas.platform.features);    // ['emotes', 'badges', 'subscriptions', ...]
});

Feature Detection

if (SBCanvas.platform.hasFeature('tips')) {
  SBCanvas.activities.on('tip', showTipAlert);
}

if (SBCanvas.platform.hasFeature('rants')) {
  SBCanvas.activities.on('rant', showRantAlert);
}

Features by Platform

FeatureKickRumbleBlaze
emotesYesYesYes
badgesYesYesYes
subscriptionsYesYesYes
followersYesYesYes
raidsYesYesNo
hostsYesNoNo
tipsYesNoYes
rantsNoYesNo
clipsYesYesNo

Example: Universal Donation Alert

Tips on Kick/Blaze and rants on Rumble are conceptually the same (paid messages). Handle both:
SBCanvas.ready(() => {
  function showDonation(activity) {
    const el = document.getElementById('donation');
    el.querySelector('.name').textContent = activity.username;
    el.querySelector('.amount').textContent = `$${activity.amount}`;
    el.querySelector('.message').textContent = activity.message || '';
    el.classList.add('show');

    SBCanvas.sound('/sounds/donate.mp3');
    SBCanvas.setTimeout(() => el.classList.remove('show'), 8000);
  }

  if (SBCanvas.platform.hasFeature('tips')) {
    SBCanvas.activities.on('tip', showDonation);
  }

  if (SBCanvas.platform.hasFeature('rants')) {
    SBCanvas.activities.on('rant', showDonation);
  }
});

Example: Platform-Specific Branding

SBCanvas.ready(() => {
  const logo = document.getElementById('platform-logo');
  const provider = SBCanvas.platform.provider;

  if (provider === 'kick') {
    logo.src = '/images/kick-logo.svg';
  } else if (provider === 'rumble') {
    logo.src = '/images/rumble-logo.svg';
  } else if (provider === 'blaze') {
    logo.src = '/images/blaze-logo.svg';
  }
});

Example: Graceful Degradation

SBCanvas.ready(() => {
  // Only show raid section if platform supports it
  if (!SBCanvas.platform.hasFeature('raids')) {
    document.getElementById('raid-section').remove();
  }

  // Only show host section on Kick
  if (!SBCanvas.platform.hasFeature('hosts')) {
    document.getElementById('host-section').remove();
  }
});

API Reference

Property/MethodReturnsDescription
platform.provider'kick' | 'rumble' | 'blaze' | nullCurrent platform
platform.channelIdstringChannel ID
platform.channelNamestringDisplay name
platform.channelSlugstring | undefinedURL slug
platform.featuresstring[]Supported feature list
platform.hasFeature(name)booleanCheck if feature is supported