Socket
Socket
Sign inDemoInstall

@anivire/twitch-embed-ts

Package Overview
Dependencies
223
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @anivire/twitch-embed-ts

Twitch Embed API Typescript wrapper


Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

twitch-embed-ts

Logo

Typescript Wrapper for Twitch Embed player / chat, based on twitch embed API

📚 View wrapper docs,
📖 View official twitch docs

Intallation

npm i @anivire/twitch-embed-ts
# or
yarn add @anivire/twitch-embed-ts

Basic usage

Be sure to add the official Twitch Embed or Player script to your index.html first:

<script src="https://embed.twitch.tv/embed/v1.js"></script>
<!-- OR / AND -->
<script src="https://player.twitch.tv/embed/v1.js"></script>

Creating new TwitchEmbed instance

TwitchEmbed allows you to embed anything, including a player and/or chat. It also contains a TwitchPlayer, which can be interacted by calling embed.getPlayer():

const embed = new TwitchEmbed(
    'twitch-embed', 
    options: {
        width: '1280',
        height: '720',
        channel: 'anivire_',
        parent: ['anivire.xyz']
    });
  1. First argument TwitchEmbed is the identifier for the <div> in which the Twitch player will be embedded as a <iframe>.

  2. Second argument is an object with player settings, which include parameters width, player height, and channel / video / collection, where channel has highest priority, meaning if both channel and video are specified, only channel (live) will be used.

Creating new TwitchPlayer instance

TwitchPlayer allows you to embed only player, without chat:

const player = new TwitchPlayer(
    'twitch-player', 
    options: {
        width: '1280',
        height: '720',
        video: '2064229582',
        parent: ['anivire.xyz']
    });

All other info provided on wrapper docs.

Keywords

FAQs

Last updated on 21 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc