pulsar-restrictions
TypeScript icon, indicating that this package has built-in type declarations

32.0.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i pulsar-restrictions

Weekly Downloads

1

Version

32.0.0

License

UNLICENSED

Unpacked Size

37.9 kB

Total Files

51

Last publish

Collaborators

  • frgjdhskxjogu