32.0.0 • Published 3 months ago

pulsar-restrictions v32.0.0

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
3 months ago

Pulsar-Restrictions

Detects and manages Twitch playback restrictions.

How to Use

import { useChannelRestrictions } from 'pulsar';

export const StreamPlayerBase = ({ channel }) => {
  const { activeRestriction, addRestriction, removeRestriction } =
    useChannelRestrictions(channel);

  if (restriction) {
    switch (restriction) {
      case 'gql-sub-only':
        return (
          <SubOnlyGate onDismiss={() => removeRestriction('gql-sub-only')} />
        );
    }
  }

  return <SomeVideoPlayer />;
};

Context Base Usage

You can also use the same system through the combination of content-specific context providers ChannelPlaybackRestrictionsRoot,ClipPlaybackRestrictionsRoot, VodPlaybackRestrictionsRoot and the usePlaybackRestrictions context consumer hook.