# twitch-stream-embed

> A Web Component for easily embedding a Twitch.tv livestream to any website

Latest version **1.0.5** (published 2021-07-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install twitch-stream-embed
pnpm add twitch-stream-embed
yarn add twitch-stream-embed
bun add twitch-stream-embed
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2021-07-03 |
| First published | 2020-11-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Matsuuu |
| Maintainers | mmatsu |
| Keywords | Twitch, Livestream, Vanilla, WebComponents, Javascript, Buildless |

## Links

- npm: https://www.npmjs.com/package/twitch-stream-embed
- Repository: https://github.com/Matsuuu/twitch-stream
- Homepage: https://github.com/Matsuuu/twitch-stream#readme
- Issues: https://github.com/Matsuuu/twitch-stream/issues
- npm.io page: https://npm.io/package/twitch-stream-embed

## Alternatives

- [@progress/kendo-ooxml](https://npm.io/package/@progress/kendo-ooxml.md) — 152.1K weekly downloads
- [@progress/kendo-react-ripple](https://npm.io/package/@progress/kendo-react-ripple.md) — 8.0K weekly downloads
- [@progress/kendo-react-orgchart](https://npm.io/package/@progress/kendo-react-orgchart.md) — 4.3K weekly downloads
- [@praxisui/dynamic-fields](https://npm.io/package/@praxisui/dynamic-fields.md) — 2.4K weekly downloads
- [@progress/kendo-vue-listbox](https://npm.io/package/@progress/kendo-vue-listbox.md) — 932 weekly downloads

## Recent versions

- 1.0.5 (latest) — 2021-07-03
- 1.0.4 — 2021-04-25
- 1.0.3 — 2020-11-22
- 1.0.2 — 2020-11-22
- 1.0.1 — 2020-11-22
- 1.0.0 — 2020-11-22

## README

![Twitch Stream Component logo](twitch-stream.png)

# TwitchStream

TwitchStream is a Web Component for embedding a Twitch Stream onto any web site with just 2 lines of HTML.

Check out a Demo [here](https://matsuuu.github.io/twitch-stream/)

## Installation

### NPM

```bash
npm install twitch-stream-embed
```

### CDN

```html
<script type="module" src="https://unpkg.com/twitch-stream-embed"></script>
```

## Usage

### With NPM

```javascript
import 'twitch-stream-embed';

<twitch-stream channel="ESL_SC2"></twitch-stream>;
```

### With CDN

```html
<script type="module" src="https://unpkg.com/twitch-stream-embed"></script>

<twitch-stream channel="ESL_SC2" chat muted></twitch-stream>
```

## Attributes

| Name            | Type          | Options                                                                                                                             |
| --------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Channel         | String        | Any channel name on Twitch.tv                                                                                                       |
| Width           | String/Number | Percentage or a Number                                                                                                              |
| Height          | String/Number | Percentage or a Number                                                                                                              |
| Theme           | String        | dark / light                                                                                                                        |
| Muted           | Boolean       | Add the "muted" attribute to start stream muted                                                                                     |
| Autoplay        | Boolean       | Add 'autoplay="false"' to disable autoplay                                                                                          |
| Chat            | Boolean       | Add the "chat" attribute to show chat next to the stream                                                                            |
| Allowfullscreen | Boolean       | Add 'allowfullscreen="false"' to disallow fullsreen viewing                                                                         |
| Parent          | String        | Only required if your site is embedded on any domain(s) other than the one that instantiates the Twitch Embed e.g. "codesandbox.io" |

## API

| Name                | Parameters                                                     | Description                                          |
| ------------------- | -------------------------------------------------------------- | ---------------------------------------------------- |
| getPlayer()         |                                                                | Returns the Player instance                          |
| play()              |                                                                | Resume / Start the stream                            |
| pause()             |                                                                | Pause the stream                                     |
| getChannel()        |                                                                | Get the name of the channel currently being streamed |
| setChannel(channel) | channel: Name of the channel                                   | Set the active stream component to given channel     |
| getQualities()      |                                                                | Get the available video qualities for the stream     |
| setQuality(quality) | quality: String containing the quality identifier. e.g. "360p" | Set the stream quality to given quality              |
| getMuted()          |                                                                | Get the muted status of the active stream            |
| setMuted(isMuted)   | isMuted: Boolean, if the stream should be muted or not         | Set the muted status to given value (true/false)     |
| getVolume()         |                                                                | Get the current volume of the stream                 |
| setVolume(volume)   | volume: A float value between 0.0 and 1.0                      | Set the current volume of the stream                 |

---
_Source: https://npm.io/package/twitch-stream-embed · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
