Giter Site home page Giter Site logo

anivire / twitch-embed-ts Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 1.29 MB

Twitch Embed API Typescript wrapper

Home Page: https://twitch-embed-ts-docs.vercel.app/getting-started

TypeScript 100.00%
twitch-embed twitch-player ts-wrapper twitch-embed-api

twitch-embed-ts's Introduction

twitch-embed-ts

Logo

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

Links

๐Ÿ“š 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.

twitch-embed-ts's People

Contributors

anivire avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.