justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 381 forks source link

Any way to change interactive player size? #511

Closed jzisser9 closed 8 years ago

jzisser9 commented 8 years ago

There doesn't appear to be a way to change an interactive player's size once it's initialized, other than re-initializing it, which isn't ideal. The closest I can get is to change the CSS 'zoom' property of the div or the entire body, depending on if I need everything in my page to remain proportionate to the player.

tadachi commented 8 years ago
this.options = {
 width: 480,
 height: 320,
 channel: 'xerokynos',
 //video: '{VIDEO_ID}'
}
var player = new Twitch.Player('twitch_player', options); // Initialized

// Change width and height of initialized. Search for iframe within twitchplayer div and change w & h
$('#twitch_player).find('iframe').css('width', 1280); // changes the width of the iframe
$('#twitch_player).find('iframe').css('height', 800); // changes the height of the iframe

Uses jQuery though.

jzisser9 commented 8 years ago

You know, I was messing around in a JavaScript console and was doing something along these lines with no success, but I didn't try jQuery. I'll give that a shot. Thanks!