JSFiddle - React, Tailwind, and code Playground
by lchau
HTML
<script src= "https://embed.twitch.tv/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: 620,
height: 540,
channel: 'monstercat',
};
const embed = new Twitch.Embed('player', options);
embed.addEventListener(Twitch.Embed.VIDEO_READY, () => console.log('ready!'));
embed.addEventListener(Twitch.Embed.VIDEO_PLAY, () => {
console.log('video played, pausing in 2500ms');
setTimeout(() => embed.getPlayer().pause(), 2500);
});