JSFiddle - React, Tailwind, and code Playground

by lchau

HTML

<script src= "https://player.twitch.tv/js/embed/v1.js"></script>
<div id='player'></div>

CSS

button {
  width: 80px;
  height: 28px;
  border: 1px solid silver;
  background-color: white;
}

JavaScript

const options = { 
  width: 640,
  height: 390,
  channel: 'twitchmedia2'
};
const player = new Twitch.Player('player', options);

player.setVolume(0.1);
// add events
player.addEventListener(Twitch.Player.READY, () => {
  console.log('ready!');
});
player.addEventListener(Twitch.Analytics.VIDEO_PLAY, payload => {
  console.log('playing:', payload);
});